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/aff83550-a1da-4e81-981e-2604e6265dc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.