centos6 ansible_playbook編譯安裝zabbix客戶端

[root@centos-1 ansible]# catcreate_users.sh

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

 

 

[root@centos-1 ansible]# catcreate_users.sh

#!/bin/bash
a=`cat /etc/passwd | grep zabbix | wc -l`
if [ $a == 0 ];then
       useradd-s /sbin/nologin zabbix
fi
[root@centos-1 ansible]# 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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章