2017-06-16 96 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并重试。

    相关问题