2017-06-16 97 views
0

運行後,下面的Ansible YAML文件中的輸出顯示文件被創建和內容發生變化Ansible文件創建沒有任何錯誤失敗

的YAML文件

--- 
- hosts: all 
    gather_facts: yes 
    connection: local 
    tasks: 
    - name: Check the date on the server. 
     action: command touch /opt/b 
    - name: cat the Content 
     action: command cat /opt/b 

運行劇本

[email protected]:/var/lib/awx/projects/test# ansible-playbook main.yml 

PLAY [all] ********************************************************************* 

TASK [setup] ******************************************************************* 
ok: [ansible-ubuntu-1604-db] 

TASK [Check the date on the server.] ******************************************* 
changed: [ansible-ubuntu-1604-db] 
[WARNING]: Consider using file module with state=touch rather than running touch 


TASK [cat the Content] ********************************************************* 
changed: [ansible-ubuntu-1604-db] 

PLAY RECAP ********************************************************************* 
ansible-ubuntu-1604-db  : ok=3 changed=2 unreachable=0 failed=0 

消息顯示c上吊= 2和犯規創建的MAC本地桌面

  • Taget節點任何文件

    [email protected]:~$ ls -l /opt/ 
    total 0 
    

    所述Env

    1. Ansible控制器任務是雲
  • 回答

    1

    隨着connection: local在你的劇本中,你告訴Ansible在你本地的控制器上執行所有任務。所以文件在您的本地機器上創建。

    刪除connection: local並重試。

    相關問題