sdfsf 发表于 2017-10-25 10:52:14

centos6 ansible_playbook编译安装zabbix客户端

# catcreate_users.sh

1
2
3
4
5
#!/bin/bash
a=`cat /etc/passwd | grep zabbix | wc -l`
if [ $a == 0 ];then
       useradd-s /sbin/nologin zabbix
fi






# catcreate_users.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
a=`cat /etc/passwd | grep zabbix | wc -l`
if [ $a == 0 ];then
       useradd-s /sbin/nologin zabbix
fi
# catjinjia_zabbix.yaml
- hosts: webserver
tasks:
-name: install zabbix package
   yum: name={{ item }} state=latest
   with_items:
    -make
    -gcc
    -curl-devel
    -curl
-name: copy pack to client
   tags: copy_pack
   copy: src=/usr/local/src/zabbix-3.2.7.tar.gzdest=/usr/local/src/zabbix-3.2.7.tar.gz
-name: tar zabbix
   tags: tar
   shell: cd /usr/local/src/;tar -xf zabbix-3.2.7.tar.gz
-name: copy create_users.sh
   tags: copy_users
   copy: src=/etc/ansible/create_users.shdest=/usr/local/src/create_users.sh
-name: create users_zabbix
   tags: users
   shell: /bin/bash /usr/local/src/create_users.sh
-name: configure zabbix
   tags: config
   shell: cd /usr/local/src/zabbix-3.2.7;./configure --with-net-snmp--with-libcurl --enable-agent --prefix=/usr/local/zabbix
-name: make make install
   tags: make
   shell: cd /usr/local/src/zabbix-3.2.7;make && make install
-name: change agented
   tags: change
   shell: cp/usr/local/src/zabbix-3.2.7/misc/init.d/fedora/core5/zabbix_agentd/etc/init.d/;chmod 700 /etc/init.d/zabbix_agentd
-name: copy zabbix_agented
   tags: copy_agented
   copy: src=/etc/init.d/zabbix_agentd dest=/etc/init.d/zabbix_agentd
-name: copy zabbix_agented,conf
   tags: copy_conf
   copy: src=/usr/local/zabbix/etc/zabbix_agentd.confdest=/usr/local/zabbix/etc/zabbix_agentd.conf
-name: start zabbix_agented
   tags: start zabbix_agented
    shell:/etc/init.d/zabbix_agentd start;chkconfig zabbix_agentd on



页: [1]
查看完整版本: centos6 ansible_playbook编译安装zabbix客户端