[英]Is it possible to run an Ansible playbook from a Chef AWS/Opworks cookbook?
I try to figure out if it's possible to create a Chef cookbook that ssh into an Ansible server and run some Ansible cookbook from AWS Opworks on the current node 我试图弄清楚是否可以创建一个ssh到Ansible服务器的Chef食谱,并在当前节点上从AWS Opworks运行一些Ansible食谱
I think of a script that I can put in a execute like this : 我想到了可以放入这样的脚本中的脚本:
define :foobar_magento2_deploy do
release_path = node[:app_release_path]
execute 'Ansible playbook' do
command "ssh -i key ansible-server 'ansible-playbook arg1 arg2'"
end
end
Do you think it's possible ? 您认为有可能吗? Is there some caveats ?
有一些警告吗? Hints ?
提示?
Edit from @coderanger answer: 从@coderanger答案编辑:
define :foobar_magento2_deploy do
release_path = node[:app_release_path]
execute 'Ansible playbook' do
command "git clone ansible-playbook"
command "cd ansible-playbook"
command "ansible-playbook -l localhost playbook.yml"
end
end
So a couple of things: 有几件事:
define
block thing in there, maybe that's an older OpsWorks syntax? define
块的东西,也许那是较旧的OpsWorks语法? ansible-playbook
locally and aim it at localhost. ansible-playbook
,并将其定位为localhost。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.