I'm using ansible to checkout my webapplication on EC2 web instances. My code is as followed:
- name: Checkout the source code
git:
accept_hostkey=yes
depth=5
dest={{ webapp_dir }}
force=yes
key_file=/var/tmp/webapp_deploy_key
[email protected]:MyRepo/web-app.git
update=yes
version={{ webapp_version }}
register: git_output
As long as webapp_version = master
it works perfectly. But as soon as I put a SHA1 or Branch name it will fail.
TASK: [webapp | Checkout the source code]
*************************************
failed: [52.17.69.83] => {"failed": true}
msg: Failed to checkout some-branch
It's quite strange.
I use:
› ansible --version
ansible 1.9.1
configured module search path = None
Checking out a branch updates the files in the working directory to match the version stored in that branch, and it tells Git to record all new commits on that branch. Think of it as a way to select which line of development you're working on.
Description. Used to pull a remote copy of ansible on each managed node, each set to run via cron and update playbook source via a source repository. This inverts the default push architecture of ansible into a pull architecture, which has near-limitless scaling potential.
And again I will answer one of my own questions. The depth=5
was the killer. Well don't use it if you want to have access to all your different versions ;)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With