ARTS-S ansible-playbook

文件a.yml

---
- hosts: cluster
  remote_user: ksotest
  gather_facts: false
  tasks:
    - name: delete dir if exists
      file:
        state: absent
        path: /home/ksotest/apps/te
    - name: create dir
      file:
        path: /home/ksotest/apps/te
        state: directory
    - name: copy extract_api
      copy:
        src: /home/ksotest/extract_api
        dest: /home/ksotest/apps/te/extract_api
        owner: ksotest
        group: ksotest
        mode: u=rwx,g=rx,o=rx
    - name: copy create config shell
      copy:
        src: /home/ksotest/create_config.sh
        dest: /home/ksotest/apps/te/create_config.sh
        owner: ksotest
        group: ksotest
        mode: u=rwx,g=rx,o=rx
    - name: create config
      shell: /home/ksotest/apps/te/create_config.sh /home/ksotest/apps/te/conf
    - name: copy run_te.sh
      copy:
        src: /home/ksotest/run_te.sh
        dest: /home/ksotest/apps/te/run_te.sh
        owner: ksotest
        group: ksotest
        mode: u=rwx,g=rx,o=rx

执行anible-playbook

ansible-playbook -i ansible_hosts.cfg a.yml

其中ansible_hosts.cfg的内容为

[cluster]
10.0.0.1
10.0.0.2
10.0.0.3
10.0.0.4

posted on 2019-01-03 21:21  荷楠仁  阅读(149)  评论(0编辑  收藏  举报

导航