Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error while evaluating conditional: ansible_distribution_version #43

Closed
joshuacox opened this issue May 8, 2015 · 5 comments
Closed

Comments

@joshuacox
Copy link

I get this failure when building on a ubuntu trusty host:

PLAY [dockerubuntu] *********************************************************** 

GATHERING FACTS *************************************************************** 
ok: [localhost]

TASK: [angstwad.docker_ubuntu | Fail if not a new release of Ubuntu] ********** 
fatal: [localhost] => error while evaluating conditional: ansible_distribution_version|version_compare(12.04, '<') or ansible_distribution_version|version_compare(12.10, '=')

FATAL: all hosts have already failed -- aborting

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/root/docker.yaml.retry

localhost                  : ok=1    changed=0    unreachable=1    failed=0   

ansible -m setup localhost full output here:
http://sprunge.us/SRKH

with the relevant section here:

        "ansible_distribution": "Ubuntu", 
        "ansible_distribution_release": "trusty", 
        "ansible_distribution_version": "14.04", 

the execution line:

  virtualbox-iso: Executing Ansible: cd /tmp/packer-provisioner-ansible-local && ANSIBLE_FORCE_COLOR=1 PYTHONUNBUFFERED=1 ansible-playbook /tmp/packer-provisioner-ansible-local/docker.yaml --limit localhost -c local -i /tmp/packer-provisioner-ansible-local/hosts

repo with packer build that is my exact setup on how I got this error:
https://github.com/joshuacox/dacksible
anyone should be able to cd into the packer directory and make vbox to get the exact error as above. Given that you have virtual box, vagrant, and packer installed amongst any other dependencies I'm forgetting.

I'm sure I'm doing something wrong as I'm still abit new to Ansible, but if anyone can shed some light on why this is failing I'd love to figure it out.

@hryamzik
Copy link
Contributor

hryamzik commented May 8, 2015

Is your ansible version below 1.6?

@joshuacox
Copy link
Author

well locally:

> ansible --version                                                                                                                                                          ~/git/dacksible/packer(master)@stealth
ansible 1.8.4
  configured module search path = /usr/share/ansible

But the error is from the one packer is using:
https://www.packer.io/docs/provisioners/ansible-local.html
which I imagine is pretty new, but I'll rebuild the machine again in debug mode and get a ansible --version from it

@angstwad
Copy link
Owner

angstwad commented May 8, 2015

That's gotta be the issue. You're missing the version_compare remotely in the packer VM.

@joshuacox
Copy link
Author

ok, so you guys nailed it. the version was 1.5.4, and packer may be controlling it, but it's the ansible inside the VM actually doing the work so I guess trusty is too old already, changing my install procedure from:

#/bin/sh
apt-get update
apt-get install -y sudo ansible python-apt python-pycurl python-pip python-virtualenv

to:

#/bin/sh
apt-get install software-properties-common
apt-add-repository ppa:ansible/ansible
apt-get update
apt-get install -y sudo ansible python-apt python-pycurl python-pip python-virtualenv

that should get me a newer ansible and clear this up.

@angstwad
Copy link
Owner

angstwad commented May 8, 2015

Glad to hear it that was the issue. Hit us up if you encounter more stuff. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants