As is always the case, once I wrote out the problem I quickly found the solution.
Downgrading to ansible 1.5.3 from https://launchpad.net/~rquillo/+archive/ansible fixes the issue. On the initial ansible play, I now see output from playbook saying it correctly interpolated the vars: PLAY [Amp] ******************************************************************** GATHERING FACTS *************************************************************** ok: [domU-12-31-39-06-32-80] domU-12-31-39-06-32-80: importing /usr/local/netflixoss-ansible/playbooks/vars/Ubuntu.yml Carry on. On Wednesday, April 2, 2014 3:54:53 PM UTC-7, Demetri Mouratis wrote: > > I have been using Peter Sankauskas's excellent netflixoss-ansible repo > successfully for the past few months. Starting sometime yesterday, the > ansible-playbook invocations started failing with the following error: > > TASK: [base | Copy rc.local template] > ***************************************** > 127.0.0.1] => One or more undefined variables: 'rc_local_path' is undefined > > I'm wrapping the whole build process in packer called by Jenkins, again > which has been working a treat. > > Packer does the following to invoke ansible: > > sudo ansible-playbook > /usr/local/netflixoss-ansible/playbooks/amp-iverson.yml --connection=local > So, I manually created a packer-builder ec2 node from a private AMI. When > I logged in, I noticed the EC2 hostname had changed form form ip-w-x-y-z to > domU-AA-BB-CC-DD-EE-FF. > > e.g.: > > domU-12-31-39-06-32-80 > > Suspicious. > > This in turn may have caused some problems for the inventory file which I > had been using, which looked like: > > sudo sh -c 'echo \"127.0.0.1 ansible_connection=local vm=0\" > > /etc/ansible/hosts' > > I cannot seem to get the following play to work successfully: > > > - name: Copy rc.local template > > copy: src={{ ansible_distribution }}/rc.local dest={{ rc_local_path }} > owner=root group=root mode=0755 > > > The vars are setup out of the top level playbook as such: > > --- > > # amp playbook for ubuntu > > - name: Amp > > user: ubuntu > > sudo: True > > tags: amp > > hosts: all > > roles: > > - base > > - amp > > - iverson > > - vagrant > > vars_files: > > - vars/{{ ansible_distribution }}.yml > > > # cat vars/Ubuntu.yml > > > ntp_service_name: ntp > > > ssh_service_name: ssh > > > mongodb_service_name: mongodb > > > tomcat_user: tomcat7 > > > rc_local_path: /etc/rc.local > > > ansible is version 1.5.4. > > OS is Ubuntu 12.04. > > On the command line, ansible 127.0.0.1 -m setup gives a full fact output > including: > > "ansible_distribution": "Ubuntu", > > Whenever I run ansible-playbook, however, the facts seem to not work > correctly. > > What's the most reliable way to invoke ansible-playbook against localhost > given that the system's hostname is a moving target? How would ansible on > the command line correctly determine facts while ansible-playbook does not? > > Thanks. > -- 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/7e6d3b2a-8b54-40b7-bfd6-717c81182dce%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
