ansible 常用模块及命令(一)
chdir 运行某命令之前先cd进入该目录
例: 先进入/root/test目录,再建一个a.txt文件
[root@VM_test_centos ~]# ansible web -m shell -a 'touch a.txt chdir=/root/test'
[WARNING]: Consider using the file module with state=touch rather than running 'touch'. If you need to use command because
file is insufficient you can add 'warn: false' to this command task or set 'command_warnings=False' in ansible.cfg to get rid
of this message.
192.168.12.2 | CHANGED | rc=0 >>
192.168.12.18 | CHANGED | rc=0 >>
[root@VM_test_centos ~]#<