I am in the process of migrating our ansible files to our internal gitlab server and have some confusion about the various ways to keep the ansible roles directory in sync with the gitlab project. The end goal is to have my team add/edit files via the web IDE on gitlab, commit the changes and have those changes pushed to the ansible (awx) server. This way the windows folks on the team does not have to log into a command line and run a pull. I can think of a few different ways to accomplish this but have some confusion on different gitlab features.
1) I have been looking at repo mirroring, specifically push mirror on gitlab. It looks like for this to work it needs to be a bare repo. When I create a bare repo on the ansible server I do not see a repo.git file to include in the URL. It doesnt sound like this is what mirroring is intended for but I am wondering if its a viable solution.
2) Web hooks, I have been looking at the post-receive web hook but do not understand how to apply it. The server is running AWX (Ansible Web GUI) and I prefer not to set up another web server to listen for web hooks. Unless I am misunderstanding how web hooks work.
3) Cron - Set up a cronjob to pull every minute. I know this will work but its hacky at best. I would prefer to use git tools and features if possible.
I understand the risk of automatically pushing to production, although in this case we are not running critical operations on AWX so the risk is low. Am I on the right track with any of these?
formatting. `push_to_awx: stage: deploy environment: Production only: - master script: - sshpass -V - export SSHPASS=$USER_PASS - sshpass -e rsync -avz --exclude .git . awx@lxansazan901s:/var/lib/awx/roles_test`
– Edyoucaterself Nov 19 '18 at 14:48