Skip to content

Instantly share code, notes, and snippets.

@frbayart
Created May 17, 2013 09:55
Show Gist options
  • Save frbayart/5598125 to your computer and use it in GitHub Desktop.
Save frbayart/5598125 to your computer and use it in GitHub Desktop.
Zabbix-agent installation with Ansible
---
- hosts: zabbix-agent
vars:
limit: 20
vars_files:
- ../global_vars.yml
- ../vars/main.yml
handlers:
- include: ../handlers/main.yml
tasks:
- name: "configuring apt repository copy dotdeb .list"
copy: src=files/dotdeb.list dest=/etc/apt/sources.list.d/dotdeb.list mode=444
- name: "configuring dotdeb GPG"
copy: src=files/dotdeb.gpg dest=/tmp/dotdeb.gpg mode=444
register: dotdebgpg_changes
- name: "configuring dotdeb preferences installation"
copy: src=files/00dotdeb dest=/etc/apt/preferences.d/00dotdeb mode=444
- name: add dotdeb GPG key
shell: cat /tmp/dotdeb.gpg | apt-key add -
only_if: '${dotdebgpg_changes.changed}'
- name: install some packages
action: apt name=$item update_cache="yes" state="installed"
only_if: '$is_debian'
tags: rpl
with_items:
- zabbix-agent
- curl
- name: "configure zabbix_agentd.conf EnableRemoteCommands"
lineinfile: dest=/etc/zabbix/zabbix_agentd.conf regexp='EnableRemoteCommands=' line='EnableRemoteCommands=1'
notify:
- zabbix-agent restart
- name: "configure zabbix_agentd.conf Server"
lineinfile: dest=/etc/zabbix/zabbix_agentd.conf regexp='Server=' line='Server=monitoring.xxx.xxx'
notify:
- zabbix-agent restart
- name: "configure zabbix_agentd.conf ServerActive"
lineinfile: dest=/etc/zabbix/zabbix_agentd.conf regexp='ServerActive=' line='ServerActive=monitoring.xxx.xxx'
notify:
- zabbix-agent restart
- name: "configure zabbix_agentd.conf Hostname"
lineinfile: dest=/etc/zabbix/zabbix_agentd.conf regexp='Hostname=' line='Hostname=${ansible_hostname}'
notify:
- zabbix-agent restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment