ansible 按顺序执行命令

2019-12-23  本文已影响0人  _fishman
---
- hosts: 10.253.253.15 10.253.253.16 10.253.253.17
  tasks:
    - name: test loop
      shell: date
      delegate_to: "{{ item }}"
      run_once: true
      with_items:
        - "{{ play_hosts }}"
      loop_control:
        pause: 2
PLAY [10.253.253.15 10.253.253.16 10.253.253.17] **********************************************************************************************************************************************

TASK [Gathering Facts] ************************************************************************************************************************************************************************
ok: [10.253.253.15]
ok: [10.253.253.17]
ok: [10.253.253.16]

TASK [test loop] ******************************************************************************************************************************************************************************
changed: [10.253.253.15 -> 10.253.253.15] => (item=10.253.253.15)
changed: [10.253.253.15 -> 10.253.253.16] => (item=10.253.253.16)
changed: [10.253.253.15 -> 10.253.253.17] => (item=10.253.253.17)

PLAY RECAP ************************************************************************************************************************************************************************************
10.253.253.15              : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
10.253.253.16              : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
10.253.253.17              : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
上一篇 下一篇

猜你喜欢

热点阅读