Ansible automated operation and maintenance --Ansible-playbook (roles) to automatically install deployment Zabbix

A, Ansible-playbook deployment zabbix-mysql

Here Insert Picture Description

Host and ip deployment Here Insert Picture Description

The basic idea: four roles to configure the total file yml scheduling
Here Insert Picture Description

1.1 mariadb

Here Insert Picture Description

1、 tasks

Here Insert Picture Description
Here Insert Picture Description

2. Trigger: handlers

Here Insert Picture Description

3, static files

1) mariadb profile:
/etc/my.cnf, adding:charactet_set_server=utf8
Here Insert Picture Description

2) zabbix database tables: create.sql.gz

Installation yum install zabbix-server-mysql -y on zabbix-server
Here Insert Picture Description
Here Insert Picture Description

In the /usr/share/doc/zabbix-server-mysql-4.0.5/, can be obtained create.sql.gz, before sending it to the server1 under devops.

Here Insert Picture Description

1.2 zabbix-server

Here Insert Picture Description

1、tasks

Here Insert Picture Description

2、handlers

Here Insert Picture Description

3、templates

On server2, will be sent to server1 zabbix_server.conf under devops
Here Insert Picture Description

Here Insert Picture Descriptiontemplates directory is placed in the template, so to change the file name suffix .j2
Here Insert Picture Description
Change the configuration file
Change the configuration file

1.3 zabbix-agent

Here Insert Picture Description

1、tasks

Here Insert Picture Description

2、handlers

Here Insert Picture Description

3、templates

On server2, will be sent to server1 zabbix_agentd.conf under devops
Here Insert Picture Description

Here Insert Picture Description
Change the file zabbix_agentd.conf.j2

Here Insert Picture Description

Here Insert Picture Description

1.4 zabbix-web

Here Insert Picture Description

1、tasks

Here Insert Picture Description

2、handlers

Here Insert Picture Description

3、templates

On server3, installation zabbix-web-server, will send his past

Here Insert Picture Description
Here Insert Picture Description

Here Insert Picture Description

Change the template file
Here Insert Picture Description

1.5 zibbix.yml file

Here Insert Picture Description
Here Insert Picture Description

1、testansible-playbook zibbix.yml
Here Insert Picture Description

2、Web access http://172.25.2.3/zabbix
Here Insert Picture Description

Here Insert Picture Description

Found error, Troubleshooting ideas:

  • selinux whether the disabled;
  • Setting the firewall
  • Whether the host security database initialization
  • When import zabbix database, login to write the playbook in and login password (login_user login_passwd)
  • Users zabbix created to be landed in the playbook written in the user login and password (login_user login_passwd), authorization and password
  • zabbix_server profile DBhost configuration file is correct

Here Insert Picture Description

Here Insert Picture Description

Here Insert Picture Description

Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description

Here Insert Picture Description

Published 102 original articles · won praise 21 · views 5325

Guess you like

Origin blog.csdn.net/ranrancc_/article/details/103220145