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] *****************************************e
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: