Ansible部署zabbix-agent
- name: copy zabbix file copy: src={{ zabbix_centos }} dest=/root/ when: ansible_distribution
== 'CentOS'
- name: rpm -ivh zabbix-agent
shell: rpm -ivh /root/{{ zabbix_centos }}
when: ansible_distribution == 'CentOS'
- name: install zabbix-agent
shell: yum -y install zabbix-agent
when: ansible_distribution == 'CentOS'
- name: copy zabbix-agent.conf
template: src=zabbix-agentd.conf.j2 dest=/etc/zabbix/zabbix_agentd.conf
when: ansible_distribution == 'CentOS'
- name: start zabbix-agent
shell: systemctl start zabbix-agent
when: ansible_distribution == 'CentOS'
- name: copyzabbix file
copy: src={{ zabbix_ubuntu }} dest=/root/
when: ansible_distribution == 'Ubuntu'
- name: install zabbix
shell: dpkg -i /root/{{ zabbix_ubuntu }}
when: ansible_distribution == 'Ubuntu'
- name: apt-get update
shell: apt-get update
when: ansible_distribution == 'Ubuntu'
- name: install zabbix
shell: apt-get install zabbix-agent
when: ansible_distribution == 'Ubuntu'
- name: copy zabbix-agent.conf
template: src=zabbix-agentd.conf.j2 dest=/etc/zabbix/zabbix_agentd.conf
when: ansible_distribution == 'Ubuntu'
- name: start zabbix
service: name=zabbix-agent state=restarted
when: ansible_distribution == 'Ubuntu'
页:
[1]