ansible一键部署(公测版)

在这里插入图片描述


[root@c7-46 66]# cat auto.yml
---
- hosts: ts
  tasks:
    - name: "传递zabbix-agent"
      template: src=zabbix-agent.sh dest=/root/
    - name: "执行"
      shell: chmod +x zabbix-agent.sh && ./zabbix-agent.sh
    - name: "传递jdk"
      copy: src=jdk-8u131-linux-x64_.rpm dest=/root/
    - name: "执行jdk"
      shell: rpm -ivh jdk-8u131-linux-x64_.rpm && java -version
    - name: "传递apach"
      unarchive: src=apache-tomcat-8.5.35.tar.gz dest=/root/
    - name: "传递tomcat脚本"
      template: src=tomcat.sh dest=/root
    - name: "执行"
      shell: chmod +x tomcat.sh && ./tomcat.sh
    - name: "supervisro脚本"
      template: src=supervisrod.sh dest=/root
    - name: "执行"
      shell: chmod +x supervisrod.sh && ./supervisrod.sh
- hosts: nk100
  tasks:
    - name: "传递zabbix-agent"
      template: src=zabbix-agent.sh dest=/root/
    - name: "执行"
      shell: chmod +x zabbix-agent.sh && ./zabbix-agent.sh
    - name: "传递nginx"
      unarchive: src=nginx-1.17.10.tar.gz dest=/root/
    - name: "传递脚本"
      template: src=nginx.sh dest=/root
    - name: "执行"
      shell: chmod +x nginx.sh && ./nginx.sh
    - name: "传递脚本"
      template: src=keealived-100.sh dest=/root
    - name: "执行"
      shell: chmod +x keealived-100.sh && ./keealived-100.sh
- hosts: nk90
  tasks:
    - name: "传递zabbix-agent"
      template: src=zabbix-agent.sh dest=/root/
    - name: "执行"
      shell: chmod +x zabbix-agent.sh && ./zabbix-agent.sh
    - name: "传递nginx"
      unarchive: src=nginx-1.17.10.tar.gz dest=/root/
    - name: "传递脚本"
      template: src=nginx.sh dest=/root
    - name: "执行"
      shell: chmod +x nginx.sh && ./nginx.sh
    - name: "传递脚本"
      template: src=keealived-90.sh dest=/root
    - name: "执行"
      shell: chmod +x keealived-90.sh && ./keealived-90.sh
- hosts: zabbix
  tasks:
    - name: "传递zzbbix脚本"
      template: src=zabbix.sh dest=/root
    - name: "执行"
      shell: chmod +x zabbix.sh && ./zabbix.sh
- hosts: mm
  tasks:
    - name: "传递zabbix-agent"
      template: src=zabbix-agent.sh dest=/root/
    - name: "执行"
      shell: chmod +x zabbix-agent.sh && ./zabbix-agent.sh
    - name: "传递脚本"
      template: src=mysql-master.sh dest=/root/
    - name: "执行"
      shell: chmod +x mysql-master.sh && ./mysql-master.sh
- hosts: ms
  tasks:
    - name: "推送nfs-zhu"
      template: src=nfs-cong.sh dest=/root/
    - name: "执行"
      shell: chmod +x nfs-cong.sh && ./nfs-cong.sh
    - name: "推送rsync-master"
      template: src=rsync-slave.sh dest=/root/
    - name: "执行"
      shell: chmod +x rsync-slave.sh && ./rsync-slave.sh
    - name: "传递zabbix-agent"
      template: src=zabbix-agent.sh dest=/root/
    - name: "执行"
      shell: chmod +x zabbix-agent.sh && ./zabbix-agent.sh
    - name: "传递脚本"
      template: src=mysql-slave.sh dest=/root/
    - name: "执行"
      shell: chmod +x mysql-slave.sh && ./mysql-slave.sh
- hosts: nr
  tasks:
    - name: "推送nfs-zhu"
      template: src=nfs-zhu.sh dest=/root/
    - name: "执行"
      shell: chmod +x nfs-zhu.sh && ./nfs-zhu.sh
    - name: "推送rsync-master"
      template: src=rsync-master.sh dest=/root/
    - name: "执行"
      shell: chmod +x rsync-master.sh && ./rsync-master.sh

- hosts: ms
  tasks:
    - name: "推送nfs-zhu"
      template: src=nfs-cong.sh dest=/root/
    - name: "执行"
      shell: chmod +x nfs-cong.sh && ./nfs-cong.sh
    - name: "推送rsync-master"
      template: src=rsync-slave.sh dest=/root/
    - name: "执行"
      shell: chmod +x rsync-slave.sh && ./rsync-slave.sh

原创文章 96 获赞 4 访问量 2173

猜你喜欢

转载自blog.csdn.net/weixin_46380571/article/details/105722060