Hi all

I'm running from HEAD  (recently ran 'git pull --rebase && git submodule
update --init --recursive' following recent restructuring).

Unfortunately I can't tell which commit I was previously running from, but
I currently have an issue with the value of a variable being used from a
different role.

I have the following structure. Real repository details are substituted for
privacy but I have been careful to preserve the alphanumerical order of the
project names.

*deploy.yml*

- name: Configure instance(s) and deploy application
  hosts: launch
  user: root
  gather_facts: true

  roles:

    - role: deploy-projectB
      tags: deploy
      when: project == 'projectB' or project == 'subprojectB'

    - role: deploy-projectA
      tags: deploy
      when: project == 'projectA'

*roles/projectB/tasks/main.yml*

- name: what repo url and dir are we cloning?
  debug: msg="repo_url={{ repo_url }} repo_dir={{ repo_dir }}"

- name: Git clone
  git: repo={{ repo_url }}
       dest={{ repo_dir }}
       version={{ repo_branch }}
       accept_hostkey=yes

*roles/projectB/vars/main.yml*

repo_url: ssh://[email protected]/myorg/projectB.git
repo_dir: /usr/local/projectB/

*roles/projectA/vars.yml*

repo_url: ssh://[email protected]/myorg/projectA.git
repo_dir: /usr/local/projectA/


Now, when running the following: ansible-playbook -vvvv deploy.yml -e
'project=projectB repo_branch=feature/blah'

I get the following output and error when the projectB role is being
applied (the error is because the origin/feature/blah branch doesn't exist
on the projectA repo)

TASK: [deploy-system | what is going on?]
*************************************
<ec2-54-183-209-28.us-west-1.compute.amazonaws.com> ESTABLISH CONNECTION
FOR USER: root
ok: [ec2-54-183-209-28.us-west-1.compute.amazonaws.com] => {
    "msg": "repo_branch=feature/blah repo_url=ssh://
[email protected]/myorg/projectA.git repo_dir=/usr/local/projectA/"
}

TASK: [deploy-system | Git clone]
*********************************************
<ec2-54-183-209-28.us-west-1.compute.amazonaws.com> ESTABLISH CONNECTION
FOR USER: root
<ec2-54-183-209-28.us-west-1.compute.amazonaws.com> REMOTE_MODULE git
repo=ssh:********@github.com/myorg/projectA.git dest=/usr/local/projectA/
version=feature/blah accept_hostkey=yes
<ec2-54-183-209-28.us-west-1.compute.amazonaws.com> EXEC ssh -C -tt -vvv -o
ControlMaster=auto -o ControlPersist=60s -o
ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r -o
StrictHostKeyChecking=no -o Port=22 -o IdentityFile="/root/.ssh/id_rsa" -o
KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o ConnectTimeout=10
ec2-54-183-209-28.us-west-1.compute.amazonaws.com /bin/sh -c 'mkdir -p
$HOME/.ansible/tmp/ansible-tmp-1412002786.78-203481241742422 && echo
$HOME/.ansible/tmp/ansible-tmp-1412002786.78-203481241742422'
<ec2-54-183-209-28.us-west-1.compute.amazonaws.com> PUT /tmp/tmpAAFWjp TO
/root/.ansible/tmp/ansible-tmp-1412002786.78-203481241742422/git
<ec2-54-183-209-28.us-west-1.compute.amazonaws.com> EXEC ssh -C -tt -vvv -o
ControlMaster=auto -o ControlPersist=60s -o
ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r -o
StrictHostKeyChecking=no -o Port=22 -o IdentityFile="/root/.ssh/id_rsa" -o
KbdInteractiveAuthentication=no -o
PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey
-o PasswordAuthentication=no -o ConnectTimeout=10
ec2-54-183-209-28.us-west-1.compute.amazonaws.com /bin/sh -c
'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/bin/python2
/root/.ansible/tmp/ansible-tmp-1412002786.78-203481241742422/git; rm -rf
/root/.ansible/tmp/ansible-tmp-1412002786.78-203481241742422/ >/dev/null
2>&1'
failed: [ec2-54-183-209-28.us-west-1.compute.amazonaws.com] => {"failed":
true}
msg: Failed to checkout feature/blah

FATAL: all hosts have already failed -- aborting

As you can see, the {{ repo_url }} and {{ repo_dir }} variables from
projectA are being incorrectly used when applying the projectB role. This
was behaving as expected* when running from an [unknown] earlier commit of
ansible so I think it was introduced recently.

* Expected behaviour would be to use the variables from
projectB/vars/main.yml

I have ensured that manually performing a git clone and git checkout does
really work with the correct details.

Thanks in advance for any input or clarification on what I may have missed,
or if it is indeed a bug.

-- 
Tom Bamford

*@Planet*
ATPLANET (Pty) Ltd
atplanet.co.za

Cell: +27 (0)79-095-7112
Fax: +27 (0)86-599-1310

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAAnNz0OHf%2Bhx7tLrmoqW6NMjJRkaRwOkk%2BX9U2%2BnTW-sce78Eg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to