+Public first commit

This commit is contained in:
pmj
2019-12-19 20:36:21 +01:00
commit ac94980413
16 changed files with 312 additions and 0 deletions

81
tasks/main.yml Executable file
View File

@@ -0,0 +1,81 @@
---
# tasks file for zabbix-agent
- name: Deploy zabbix repo
template:
src: templates/zabbix.list.j2
dest: /etc/apt/sources.list.d/zabbix.list
force: yes
owner: root
group: root
mode: '0644'
when: ansible_distribution == 'Debian'
- name: Deploy zabbix repo GPG
copy:
src: templates/zabbix-official-repo.gpg
dest: /etc/apt/trusted.gpg.d/zabbix-official-repo.gpg
force: yes
owner: root
group: root
mode: '0644'
when: ansible_distribution == 'Debian'
- name: Install zabbix_agent Debian
apt:
name:
- zabbix-agent
- zabbix-get
- zabbix-sender
state: latest
update_cache: yes
when: ansible_distribution == 'Debian'
- name: Deploy custom config
template:
src: templates/custom.conf.j2
dest: /etc/zabbix/zabbix_agentd.d/custom.conf
owner: root
group: root
mode: '0644'
notify: zabbix-agent restart
- name: Deploy custom TLS config
template:
src: templates/tls.conf.j2
dest: /etc/zabbix/zabbix_agentd.d/tls.conf
owner: root
group: root
mode: '0644'
when: zabbix_psk != False
notify: zabbix-agent restart
- name: Deploy zabbix PSK
template:
src: templates/zabbix_agentd.psk.j2
dest: /etc/zabbix/zabbix_agentd.psk
force: yes
owner: zabbix
group: zabbix
mode: '0600'
when: zabbix_psk != False
notify: zabbix-agent restart
# Using system hostname
- name: Change default config
lineinfile:
path: /etc/zabbix/zabbix_agentd.conf
regex: "^Hostname="
line: "#Hostname=Zabbix server"
notify: zabbix-agent restart
# Using ansible hostname
# - name: Change default config
# lineinfile:
# path: /etc/zabbix/zabbix_agentd.conf
# regex: "^Hostname="
# line: "Hostname={{inventory_hostname | lower}}"
# notify: zabbix-agent restart