Undefined variables

377 views
Skip to first unread message

Arangel Angov

unread,
Nov 3, 2014, 5:21:59 PM11/3/14
to ansible...@googlegroups.com
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}
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.
--
Arangel

--
*Disclaimer*

This email is really important (well, most of them are.). Also, hopefully
the message has been sent to the person it’s intended for. If we stuffed up
by entering the wrong email address, we’re very sorry for cluttering up
your inbox. But if we have done that, then please do us a favour and let us
know…and if you could keep the juicy bits to yourself, that would be great
too.

Also…stuff that’s said in this message are the views of the person writing
the email and do not actually represent the views of Gramble World
(although they might, but we’re just hedging our bets here). Don’t think
for one minute that anything in this message should be construed as
creating a contract.

Gramble World owns the email infrastructure, including the contents.

Finally…do the right thing by the environment and “think before you ink”!

**********************************************************************

Michael DeHaan

unread,
Nov 3, 2014, 6:10:57 PM11/3/14
to ansible...@googlegroups.com
Where you have:

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

Where is this defined?

Also, where is the vault file?

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 ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/54580003.7080908%40gramble.com.
For more options, visit https://groups.google.com/d/optout.

Arangel Angov

unread,
Nov 4, 2014, 1:29:02 AM11/4/14
to ansible...@googlegroups.com
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.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
--
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 ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgxSc60WnO2tJDinSHFgX1VcO_%3DUFeeu4u3ievgXT%2BwiDw%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.


--
Arangel Angov

Systems Operations




Disclaimer

Michael DeHaan

unread,
Nov 4, 2014, 9:52:28 AM11/4/14
to ansible...@googlegroups.com
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.




Arangel Angov

unread,
Nov 6, 2014, 7:44:59 AM11/6/14
to ansible...@googlegroups.com
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.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages