2121 group : zabbix
2222 mode : " 0o755"
2323
24- - name : Adjust zabbix agent configuration
24+ - name : Adjust zabbix agent2 configuration
2525 template :
26- src : zabbix/zabbix_agentd .conf.j2
27- dest : /etc/zabbix/zabbix_agentd .conf
26+ src : zabbix/zabbix_agent2 .conf.j2
27+ dest : /etc/zabbix/zabbix_agent2 .conf
2828 mode : " 0o644"
29- notify : zabbix-agent
29+ notify : zabbix-agent2
3030
3131- name : Copy Zabbix Host delete script
3232 copy :
3838 pip :
3939 name : zabbix-api
4040
41- - name : Install zabbix agent
41+ - name : Install zabbix agent2
4242 apt :
43- name : zabbix-agent
43+ name : zabbix-agent2
4444 state : present
4545 when : " ansible_distribution_file_variety == 'Debian'"
4646
5050 state : present
5151 when : " ansible_distribution_file_variety == 'RedHat'"
5252
53- - name : Start and Enable zabbix-agent
53+ - name : Start and Enable zabbix-agent2
5454 systemd :
55- name : zabbix-agent
55+ name : zabbix-agent2
5656 state : started
5757 enabled : true
5858
6161# --------------------------------------
6262
6363- name : Add worker node to zabbix hosts
64+ vars :
65+ ansible_network_os : community.zabbix.zabbix
66+ ansible_connection : httpapi
67+ ansible_httpapi_port : 80
68+ ansible_http_use_ssl : false
69+ ansible_user : Admin
70+ ansible_httpapi_pass : " {{ zabbix_conf.admin_password }}"
6471 zabbix_host :
65- server_url : " http://127.0.0.1/zabbix/"
66- login_user : Admin
67- login_password : " {{ zabbix_conf.admin_password }}"
6872 host_name : " {{ ansible_hostname }}"
6973 visible_name : " {{ ansible_hostname }}"
7074 description : add by ansible
8488 when : " 'master' not in group_names"
8589 delegate_to : localhost
8690
91+ # --------------------------------------
92+ # -- Add master node as zabbix hosts --
93+ # --------------------------------------
94+
8795- name : Add master node to zabbix hosts
96+ vars :
97+ ansible_network_os : community.zabbix.zabbix
98+ ansible_connection : httpapi
99+ ansible_httpapi_port : 80
100+ ansible_http_use_ssl : false
101+ ansible_user : Admin
102+ ansible_httpapi_pass : " {{ zabbix_conf.admin_password }}"
88103 zabbix_host :
89- server_url : " http://127.0.0.1/zabbix/"
90- login_user : Admin
91- login_password : " {{ zabbix_conf.admin_password }}"
92104 host_name : " {{ ansible_hostname }}"
93105 visible_name : " {{ ansible_hostname }}"
94106 description : add by ansible
105117 useip : 1 # connect using host IP address
106118 port : 10050
107119 become : false
108- when : " 'master' in group_names"
120+ when : " 'master' in group_names"
0 commit comments