制作zabbix和memcache的yml文本源代码

[root@localhost roles]# vim zabbix/tasks/zabbix.yml
- name: add user
  user: name=zabbix state=present
- name: an yi lai bao
  yum: name=net-snmp,net-snmp-devel,curl-devel,java-1.8.0-openjdk,java-1.8.0-openjdk-devel,OpenIPMI-devel,mysql state=present 
- name: chuan bao
  copy: src=/root/zabbix-3.2.1.tar.gz dest=/root
- name: jie bao
  shell: tar zxf zabbix-3.2.1.tar.gz
- name: pei zhi
  shell: chdir=/root/zabbix-3.2.1 ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --enable-java  --with-net-snmp --with-mysql=/usr/bin/mysql_config --with-libcurl --with-openipmi
- name: bian yi 
  shell: chdir=/root/zabbix-3.2.1 make && make install
- name: ruan lian jie
  shell: ln -s /usr/local/zabbix/bin/* /usr/local/bin/
- shell: ln -s /usr/local/zabbix/sbin/* /usr/local/sbin/
- name: fuzhi qi dong wenjian
  copy: src=/root/ld.so.conf dest=/etc
- shell: ldconfig
- name: ba gai hao de peizhifile gei 1.20
  copy: src=/root/zabbix_server.conf dest=/usr/local/zabbix/etc/
- include: /etc/ansible/roles/zabbix/tasks/db.yml
- name: ba an zhuang ye mian gei nginx htmlxia
  shell: chdir=/root/zabbix-3.2.1 cp -r frontends/php/ /usr/local/nginx/html/zabbix
- name: gei quan xian
  shell: chmod 777 /usr/local/nginx/html/zabbix
- name: qi dong
  shell: /usr/local/zabbix/sbin/zabbix_server -c /usr/local/zabbix/etc/zabbix_server.conf



[root@localhost roles]# vim zabbix_agent/tasks/agent.yml
- name: ba bao chuan guoqu
  copy: src=/root/zabbix-3.2.1.tar.gz dest=/root
- name: jie bao
  shell: tar -zxf zabbix-3.2.1.tar.gz
- name: bianyi 
  shell: chdir=/root/zabbix-3.2.1 ./configure --prefix=/usr/local/zabbix --enable-agent && make && make install
- name: tian jia fu wu 
  shell: chdir=/root/zabbix-3.2.1 cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d
- name: jia jue se
  user: name=zabbix state=present
- name: kai ji zi qi 
  shell: chkconfig --add zabbix_agentd
- shell: chkconfig zabbix_agentd on
- name: xiu gai  qi dong dizhi
  shell: sed -i -e 's/BASEDIR=/usr/local/BASEDIR=/usr/local/zabbix/g' /etc/init.d/zabbix_agentd
- shell: systemctl daemon-reload
- name: wo men she zhi yi xia agent de pei zhi file
  template: src=zabbix_agentd.conf.j2 dest=/usr/local/zabbix/etc/zabbix_agentd.conf
- name: kai fu wu
  shell: /etc/init.d/zabbix_agentd start
- name: kai fang huo qiang
  shell: firewall-cmd --add-port=10050/tcp --permanent
- shell: firewall-cmd --reload


[root@localhost roles]# vim memcache/tasks/me.yml
- name: chuan bao
  copy: src=/root/libevent-2.0.22-stable.tar.gz dest=/root
- name: jie bao
  shell: tar zxf libevent-2.0.22-stable.tar.gz
- name: bian yi an zhuang
  shell: chdir=/root/libevent-2.0.22-stable ./configure && make && make install
- name: chuan memcached
  copy: src=/root/memcached-1.4.33.tar.gz dest=/root
- name: jie bao
  shell: tar zxf memcached-1.4.33.tar.gz
- name: pei zhi an zhuang
  shell: chdir=/root/memcached-1.4.33 ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local && make && make install
- name: kai fu wu
  shell: /usr/local/memcached/bin/memcached -d -m 2048 -l 192.168.1.30 -p 11211 -u root -c 10240 -P /usr/local/memcached/memcached.pid
原文地址:https://www.cnblogs.com/mayaohui/p/11372644.html