ansible-playbook实战zabbix-agent

2018-12-27

zabbix-agent.yml

  • hosts: web
    remote_user: root
    tasks:
    ​ - name: shell init system
    ​ shell: setenforce 0
    ​ - name: copy zabbix-release
    ​ copy: src=/root/zabbix-release-3.4-1.el7.centos.noarch.rpm dest=/root/zabbix-release-3.4-1.el7.centos.noarch.rpm force=yes
    ​ - name: yum zabbix-agent
    ​ yum: name= state=present disable_gpg_check=yes
    ​ with_items:
    ​ - { name: ‘/root/zabbix-release-3.4-1.el7.centos.noarch.rpm’ }
    ​ - { name: ‘zabbix-agent’ }
    ​ - name: copy zabbix-config file
    ​ copy: src=/root/zabbix_agentd.conf dest=/etc/zabbix/zabbix_agentd.conf force=yes
    ​ - name: start service for zabbix-agent
    ​ service: name=zabbix-agent state=started