Skip to content

Instantly share code, notes, and snippets.

@masahide
Created August 17, 2013 05:47
Show Gist options
  • Save masahide/6255484 to your computer and use it in GitHub Desktop.
Save masahide/6255484 to your computer and use it in GitHub Desktop.
ansible でzabbixのplaybookを作る ref: http://qiita.com/yamasaki-masahide/items/2f98b572ff5451b8221c
- name: install zabbix-server
yum: name={{item}} enablerepo=epel state=installed
with_items:
- zabbix20-server-mysql
- zabbix20-web
- MySQL-python
tags: zabbix-server
- name: add zabbix dbuser
mysql_user: login_host=localhost login_user={{ dbroot }} login_password={{ dbpass }} name=zabbix password={{ zabbix_db_pass }} priv=zabbix.*:ALL
tags: zabbix-server
- name: add database
mysql_db: login_host=localhost login_user={{ dbroot }} login_password={{ dbpass }} name=zabbix encoding=utf8
tags: zabbix-server
- name: check tables
shell: mysql -u{{ dbroot }} -p{{ dbpass }} zabbix -e"show tables"
register: show_tables
tags: zabbix-server
- name: create tables
shell: |
mysql -u{{ dbroot }} -p{{ dbpass }} zabbix < /usr/share/zabbix-mysql/schema.sql &&
mysql -u{{ dbroot }} -p{{ dbpass }} zabbix < /usr/share/zabbix-mysql/images.sql &&
mysql -u{{ dbroot }} -p{{ dbpass }} zabbix < /usr/share/zabbix-mysql/data.sql
when: show_tables.stdout.find("user_history") == -1
tags: zabbix-server
- name: start zabbix-server
service: name=zabbix-server state=started enabled=yes
- name: install ipa_font
yum: name=ipa-pgothic-fonts state=installed
- name: set DBPassword
lineinfile: dest=/etc/zabbix_server.conf regexp="^DBPassword=" insertafter="^# DBPassword=" line=DBPassword={{ zabbix_db_pass }}
tags: zabbix-server
- name: set ipa font
shell: |
sed -i "s/dejavu/pa-pgothic/" /usr/share/zabbix/include/defines.inc.php &&
sed -i "s/DejaVuSans/ipagp/" /usr/share/zabbix/include/defines.inc.php
tags: zabbix-server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment