[Ansible]script模块


  • 将管理节点的脚本上传至被管理节点执行,理论上此模块不许需要被管理服务器上有python
[root@ceph1 ~]# cat a.sh
touch /tmp/ansible-script

[root@ceph1 ~]# ansible webservers -m script -a "a.sh"
ceph3 | CHANGED => {
    "changed": true,
    "rc": 0,
    "stderr": "Shared connection to ceph3 closed.\r\n",
    "stderr_lines": [
        "Shared connection to ceph3 closed."
    ],
    "stdout": "",
    "stdout_lines": []
}

[root@ceph1 ~]# ansible webservers -m shell -a "ls -l /tmp/ | grep ansible"
ceph3 | CHANGED | rc=0 >>
drwx------  2 root root       41 9月  14 11:50 ansible_command_payload_kxNYUy
-rw-r--r--  1 root root        0 9月  14 11:48 ansible-script

END


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM