Is it possible to have ansible use a “remote” playbook for git-based continuous deployment?

可紊 提交于 2020-04-16 04:56:59

问题


I need to manage a few servers that run code that is currently being deployed there as a couple of git repositories. I would like to be able to store in the project's repository the parts (if not all) of the playbook that is relevant for the repository. For example, the list of package dependencies, virtualenv requirements, configuration templates. This will also allow those to change in a per branch/commit way. Meaning I can make sure that if I need to deploy a specific branch/commit, playbook that is correct for that commit is being used, if, say, the configuration template being used changed.

It seems like the only solution is to checkout the git repository locally. Is it possible in ansible to tell it to run a remote play book (from the git repository that is being checked out on the server)? I was thinking of having ansible run a ansible using a local connection on the remote host, I haven't tried it to see if this will actually work out.

How do people manage to use ansible for continuous deployment based on git without some mechanisms for running a remote playbook?


回答1:


Take a look at ansible-pull. It pulls the repo and executes playbook.



来源:https://stackoverflow.com/questions/39551679/is-it-possible-to-have-ansible-use-a-remote-playbook-for-git-based-continuous

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!