--- - name: install zabbix-agent conf hosts: lichuan vars: zabbix_server_ip: 10.3.229.14 zabbix_agent_ip: "{{ ansible_em1.ipv4.address }}" gather_facts: true ignore_errors: yes tasks: - name: install zabbix agent rpm copy: src=/etc/ansible/roles/files/zabbix-release-5.0-1.el7.noarch.rpm dest=/usr/local/src/ owner=root group=root mode=0644 - name: rpm -ivh zabbix agent shell: rpm -ivh /usr/local/src/zabbix-release-5.0-1.el7.noarch.rpm - name: yum install zabbix-agent yum: name=zabbix-agent state=present - name: Copy zabbix agent configuration file template: src=/etc/ansible/roles/template/zabbix_agentd.conf.j2 dest=/etc/zabbix/zabbix_agentd.conf - name: Start zabbix agent service: name=zabbix-agent state=started enabled=true
标签:src,name,agent,zabbix,ansible,rpm From: https://www.cnblogs.com/litzhiai/p/17040463.html