ansible执行status

[root@centos5 pltestmodule]# ansible-playbook -i hosts testdate.yaml 

PLAY [local] *******************************************************************************************************

TASK [echo date] ***************************************************************************************************
changed: [localhost]

TASK [echo date_output] ********************************************************************************************
changed: [localhost]

PLAY RECAP *********************************************************************************************************
localhost                  : ok=2    changed=2    unreachable=0    failed=0   

[root@centos5 pltestmodule]# vim testdate.yaml 
[root@centos5 pltestmodule]# ansible-playbook -i hosts testdate.yaml 

PLAY [local] *******************************************************************************************************

TASK [echo date] ***************************************************************************************************
changed: [localhost]

TASK [echo date_output] ********************************************************************************************
skipping: [localhost]

PLAY RECAP *********************************************************************************************************
localhost                  : ok=1    changed=1    unreachable=0    failed=0   
---
- hosts: local
  remote_user: root
  gather_facts: False
  tasks:
    - name: echo date
      command: date
      register: date_output
    - name: echo date_output
      command: echo "5"
      when: date_output.stdout.split(" ")[3] == "5"  #第二种情况skipping
      #notify: 
      #- output test
  handlers:
    - name: output test
      shell: ls /root

猜你喜欢

转载自blog.csdn.net/jackliu16/article/details/80585172
今日推荐