Undefined variables

Hi,

I've upgraded to Ansible 1.7.2-1 (using Arch linux) last week and I've noticed that variables from the vault are not being recognized anymore. Tried to recreate this on several machines with the same version of Ansible, it fails on all of them.

I'm using a template file for uwsgi that also holds some environment variables, for example:

env = VAR_1={{ VAR[branch].id1 }}

In the vault I have:

VAR:
     production:
          id1: 1234
     staging:
          id1: 9999
     develop:
          id1: 1111

I run the playbook with --ask-vault-pass and when it gets to the task that copies my uwsgi template file to the server I get the following:

TASK: [test | Copying uwsgi configuration file...] **************

fatal: [x.x.x.x] => {'msg': "AnsibleUndefinedVariable: One or more undefined variables: 'VAR' is undefined", 'failed': True}

Worked perfectly fine a week ago when I ran the same playbook with the same configuration, the vault hasn't been modified either.

I'm also using an ad-hoc group created with add_hosts, but that shouldn't be an issue here as far as I can see.

Anything more I can do to troubleshoot? Did anyone came across a similar issue lately?

Thanks.

Where you have:

env = VAR_1={{ VAR[branch].id1 }}

Where is this defined?

Also, where is the vault file?

Thanks!

Hi Michael,

That's all defined in the vault file, the entry is from the uwsgi vassal configuration file.

The vault file is currently in group_vars/all/vault.

Thanks.

(attachments)


social-media-icons_twitter.png
space.png
social-media-icons_facebook.png
social-media-icons_googleplus.png
social-media-icons_linkedin.png
social-media-icons_instagram.png
social-media-icons_youtube.png

That should be fine as long as it has no extension or .yml or .yaml so I wonder if you have something else in your playbook that might just be confusing, and it’s not an issue with vault files being skipped.

(attachments)

social-media-icons_twitter.png


space.png
social-media-icons_youtube.png
social-media-icons_linkedin.png
social-media-icons_facebook.png
social-media-icons_instagram.png
social-media-icons_googleplus.png

Just for future reference if anyone encounters the issue, we're using AWS.

We were reorganizing and moved the the ec2.py and ec2.ini files in a
directory called "inventory", group_vars (where the vault was) and
host_vars are suppose to go there too for this to work properly.

Thanks for the help.