注:-a參數後的命令用單引號,單引號,單引號;雙引號有可能會出問題,特別是在user模塊;json
ansible all -m ping -B 3600 -P 0 172.16.1.11 | SUCCESS => { "ansible_job_id": "827931270385.17901", "changed": true, "finished": 0, "results_file": "/root/.ansible_async/827931270385.17901", "started": 1 } 172.16.1.10 | SUCCESS => { "ansible_job_id": "253754505233.18739", "changed": true, "finished": 0, "results_file": "/root/.ansible_async/253754505233.18739", "started": 1 }
當Ansible後臺執行程序的時候會給咱們一個ansible_job_id,以便咱們隨時能夠去查看程序執行的狀態:併發
ansible all -m async_status -a "jid='253754505233.18739'" 172.16.1.10 | SUCCESS => { "ansible_job_id": "253754505233.18739", "changed": false, "finished": 1, "ping": "pong" }