企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
常用参数: chdir 运行command命令前先cd到这个目录 creates 当指定的这个参数对应的文件存在,就不行command命令,如果不存在,那么就运行command命令 案例: ~~~ [admin@node1 ~]$ ansible webserver -m command -a "chdir=/tmp touch aa01.txt" [WARNING]: Consider using file module with state=touch rather than running touch 192.168.52.130 | SUCCESS | rc=0 >> 192.168.52.132 | SUCCESS | rc=0 >> 192.168.52.131 | SUCCESS | rc=0 >> ~~~ ~~~ [admin@node1 ~]$ ansible webserver -m command -a "chdir=/tmp touch testfile.txt creates=/tmp/aa01.txt" 192.168.52.130 | SUCCESS | rc=0 >> skipped, since /tmp/aa01.txt exists 192.168.52.132 | SUCCESS | rc=0 >> skipped, since /tmp/aa01.txt exists 192.168.52.131 | SUCCESS | rc=0 >> skipped, since /tmp/aa01.txt exists ~~~