- name: Create dir to keep install file file: path=/opt/pacheage state=directory follow=yes force=yes - name: Copy {{ pacheage_name }}.tar.gz copy: src={{ pacheage_name }}.tar.gz dest=/opt/pacheage/ - name: Delete last time install {{ pacheage_name }} dir file: path=/opt/{{ pacheage_name }} state=absent - name: Delete last time Unarchive {{ pacheage_name }} dir file: path=/opt/pacheage/{{ pacheage_name }} state=absent - name: Unarchive {{ pacheage_name }}.tar.gz unarchive: src=/opt/pacheage/{{ pacheage_name }}.tar.gz dest=/opt/pacheage/ copy=no - name: Install dependent package yum: name: - gcc - net-snmp-devel - libevent-devel - libcurl-devel state: present - name: Add the zabbix user user: name: zabbix comment: Zabbix Monitoring System system: yes shell: /sbin/nologin - name: Install zabbix agent shell: cd /opt/pacheage/{{ pacheage_name }} && ./configure --prefix=/opt/{{ pacheage_name }} --enable-agent && make && make install - name: Chown /opt/{{ pacheage_name }} file: path: /opt/{{ pacheage_name }} owner: zabbix group: zabbix recurse: yes - name: Copy zabbix_agentd.conf.j2 template: src: zabbix_agentd.conf.j2 dest: /opt/zabbix-4.2.3/etc/zabbix_agentd.conf owner: zabbix group: zabbix - name: Start agent shell: /opt/{{ pacheage_name }}/sbin/zabbix_agentd