Commit 6304b427 by 杜崇铭

Add zabbix mod

parent 1f160c56
...@@ -26,5 +26,5 @@ Zabbix ...@@ -26,5 +26,5 @@ Zabbix
使用: 使用:
1-5同上 1-5同上
6. 修改roles/zabbix_server/templates/zabbix_server.conf和roles/zabbix_agent/templates/zabbix_agentd.conf中的变量 6. 修改变量 roles/zabbix_server/templates/zabbix_server.conf(DB开头的三个变量),roles/zabbix_agent/templates/zabbix_agentd.conf(Server变量),roles/zabbix_server/files/zabbix_db.sh(mysql的变量),var/main.yml(mysql args变量)
7. 运行ansible-playbook -i host.yml -u root zabbix.yml 7. 运行ansible-playbook -i host.yml -u root zabbix.yml
\ No newline at end of file
[local] [local]
localhost
[zabbix_server] [zabbix_server]
118.25.142.187 118.25.142.187
[zabbix_agent] [zabbix_agent]
106.15.184.18 106.15.184.18
\ No newline at end of file 106.15.184.19
106.15.184.20
\ No newline at end of file
#!/bin/bash #!/bin/bash
mysql -u root -p 1q2w3e4r zabbix -e "grant all privileges on zabbix.* to zabbix@localhost identified by '1q2w3e4r';" mysql -u root -p1q2w3e4r -e "create database zabbix character set utf8 collate utf8_bin;"
cd /usr/share/doc/zabbix-server-mysql-3.4.0 mysql -u root -p1q2w3e4r -D zabbix -e "grant all privileges on zabbix.* to zabbix@localhost identified by '1q2w3e4r';"
zcat create.sql.gz | mysql -uroot -p1q2w3e4r zabbix zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p1q2w3e4r zabbix
\ No newline at end of file \ No newline at end of file
...@@ -9,16 +9,6 @@ ...@@ -9,16 +9,6 @@
name: "{{ zabbix_server_packages }}" name: "{{ zabbix_server_packages }}"
state: latest state: latest
- name: "mysql operation"
mysql_db:
name: zabbix
login_host: 127.0.0.1
login_port: "{{ mysql_port }}"
login_user: root
login_password: "{{ login_password }}"
encoding: utf8
state: present
- name: "copy mysql shell script" - name: "copy mysql shell script"
copy: copy:
src: zabbix_db.sh src: zabbix_db.sh
......
118.25.142.187
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment