問題:
Is it possible to run commands on the Ansible host?是否可以在 Ansible 主機上運行命令?
My scenario is that I want to take a checkout from a git server that is hosted internally (and isn't accessible outside the company firewall).我的情況是我想從內部託管的 git 服務器(並且在公司防火牆之外無法訪問)進行結賬。 Then I want to upload the checkout (tarballed) to the production server (hosted externally).然後我想將結帳(壓縮包)上傳到生產服務器(外部託管)。
At the moment, I'm looking at running a script that does the checkout, tarballs it, and then runs the deployment script - but if I could integrate this into Ansible that would be preferable.目前,我正在考慮運行一個腳本來進行結賬、壓縮它,然後運行部署腳本——但如果我可以將它集成到 Ansible 中,那將是可取的。
解決方案:
參考一: https://en.stackoom.com/question/1HIoW參考二: https://stackoom.com/question/1HIoW