[root@centos-1 ansible]# catcreate_users.sh
#!/bin/bash a=`cat/etc/passwd|grepzabbix|wc-l` if[$a==0];then useradd-s/sbin/nologinzabbix fi
[root@centos-1 ansible]# catcreate_users.sh
#!/bin/bash a=`cat/etc/passwd|grepzabbix|wc-l` if[$a==0];then useradd-s/sbin/nologinzabbix fi [root@centos-1ansible]#catjinjia_zabbix.yaml -hosts:webserver tasks: -name:installzabbixpackage yum:name={{item}}state=latest with_items: -make -gcc -curl-devel -curl -name:copypacktoclient tags:copy_pack copy:src=/usr/local/src/zabbix-3.2.7.tar.gzdest=/usr/local/src/zabbix-3.2.7.tar.gz -name:tarzabbix tags:tar shell:cd/usr/local/src/;tar-xfzabbix-3.2.7.tar.gz -name:copycreate_users.sh tags:copy_users copy:src=/etc/ansible/create_users.shdest=/usr/local/src/create_users.sh -name:createusers_zabbix tags:users shell:/bin/bash/usr/local/src/create_users.sh -name:configurezabbix tags:config shell:cd/usr/local/src/zabbix-3.2.7;./configure--with-net-snmp--with-libcurl--enable-agent--prefix=/usr/local/zabbix -name:makemakeinstall tags:make shell:cd/usr/local/src/zabbix-3.2.7;make&&makeinstall -name:changeagented tags:change shell:cp/usr/local/src/zabbix-3.2.7/misc/init.d/fedora/core5/zabbix_agentd/etc/init.d/;chmod700/etc/init.d/zabbix_agentd -name:copyzabbix_agented tags:copy_agented copy:src=/etc/init.d/zabbix_agentddest=/etc/init.d/zabbix_agentd -name:copyzabbix_agented,conf tags:copy_conf copy:src=/usr/local/zabbix/etc/zabbix_agentd.confdest=/usr/local/zabbix/etc/zabbix_agentd.conf -name:startzabbix_agented tags:startzabbix_agented shell:/etc/init.d/zabbix_agentdstart;chkconfigzabbix_agentdon原文链接:https://www.f2er.com/centos/375470.html