Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ansible git module not checking out a branch

Tags:

git

ansible

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 = masterit 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
like image 382
gtheys Avatar asked Jun 12 '15 09:06

gtheys


People also ask

What is a checked out branch?

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.

What is ansible pull?

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.


1 Answers

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 ;)

like image 109
gtheys Avatar answered Oct 20 '22 00:10

gtheys