Created
November 23, 2021 19:22
-
-
Save andretapxure/7d52518b0e3800e29cd97e2a9043f284 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #This gist is intended to install Zabbix-agent2 5.4 on Ubuntu 16/18/20 | |
| #Just create the hosts file and run | |
| #ansible-playbook -i hosts zabbix.yml | |
| - hosts: all | |
| user: ubuntu | |
| become: yes | |
| vars: | |
| zbx_srv: monitor.solidops.cloud | |
| tasks: | |
| - name: check OS | |
| debug: msg=https://repo.zabbix.com/zabbix/5.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.4-1+{{ansible_distribution | lower}}{{ansible_distribution_version | lower}}_all.deb | |
| - name: Install Zabbix Repo | |
| apt: | |
| deb: https://repo.zabbix.com/zabbix/5.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.4-1+{{ansible_distribution | lower}}{{ansible_distribution_version | lower}}_all.deb | |
| - name: Update repositories cache and install "Zabbi-agent2" package | |
| apt: | |
| name: zabbix-agent2 | |
| update_cache: yes | |
| - name: change zabbix_agentd.conf Hostname | |
| lineinfile: | |
| path: /etc/zabbix/zabbix_agent2.conf | |
| state: present | |
| regexp: 'Hostname=Zabbix server' | |
| line: "Hostname={{ ansible_hostname }}" | |
| - name: change zabbix_agentd.conf ServerActive | |
| lineinfile: | |
| path: /etc/zabbix/zabbix_agent2.conf | |
| state: present | |
| regexp: 'ServerActive=127.0.0.1' | |
| line: "#ServerActive={{ zbx_srv }}" | |
| - name: change zabbix_agentd.conf Server | |
| lineinfile: | |
| path: /etc/zabbix/zabbix_agent2.conf | |
| state: present | |
| regexp: 'Server=127.0.0.1' | |
| line: "Server={{ zbx_srv }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment