[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