Ansible Script 추가
This commit is contained in:
40
ansible/01_old/roles/zabbix-agent/handlers/main.yml
Normal file
40
ansible/01_old/roles/zabbix-agent/handlers/main.yml
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
# handlers file for zabbix-agent
|
||||
|
||||
- name: restart zabbix-agent
|
||||
ansible.builtin.service:
|
||||
name: "{{ zabbix_agent_service }}"
|
||||
state: restarted
|
||||
enabled: true
|
||||
become: true
|
||||
when:
|
||||
- not zabbix_agent_docker
|
||||
- ansible_os_family != "Windows" and ansible_os_family != "Darwin"
|
||||
|
||||
- name: firewalld-reload
|
||||
ansible.builtin.command: "firewall-cmd --reload"
|
||||
become: true
|
||||
when:
|
||||
- ansible_facts.services["firewalld"] is defined
|
||||
- ansible_facts.services["firewalld"].state == "running"
|
||||
|
||||
- name: restart win zabbix agent
|
||||
win_service:
|
||||
name: "{{ zabbix_win_svc_name }}"
|
||||
state: restarted
|
||||
when:
|
||||
- ansible_os_family == "Windows"
|
||||
|
||||
- name: restart mac zabbix agent
|
||||
ansible.builtin.command: "launchctl kickstart -k system/{{ zabbix_agent_service }}"
|
||||
become: true
|
||||
when:
|
||||
- not zabbix_agent_docker
|
||||
- ansible_os_family == "Darwin"
|
||||
|
||||
- name: "clean repo files from proxy creds"
|
||||
ansible.builtin.shell: ls /etc/yum.repos.d/zabbix* && sed -i 's/^proxy =.*//' /etc/yum.repos.d/zabbix* || true
|
||||
become: true
|
||||
when:
|
||||
- ansible_os_family == 'RedHat'
|
||||
- zabbix_http_proxy is defined or zabbix_https_proxy is defined
|
||||
Reference in New Issue
Block a user