Passing variable to hosts as extra value doesn't work in Tower

123 views
Skip to first unread message

David Goodall

unread,
Jan 14, 2015, 12:32:04 PM1/14/15
to ansible...@googlegroups.com
Hi,

I am trying to select hosts for a play based on a variable passed at job launch time in Tower:

hosts: "{{ project_name }}-masters:{{ project_name }}-slaves"

This will allow me to create and administer different stacks separately within the same Rackspace account.

I have read elsewhere that inventory variables are different to variables created in the playbook, but that a variable passed on the command-line with -e should be available to use with hosts: in a play.
I have project_name set up as an extra variable in the job template in Tower but this doesn't have the desired effect.
The plays with hosts referenced in this way all skip through with "no hosts matched".
I can see in the std-out that the project_name variable is correctly formed.

Is there a way I can define my hosts based on a variable like this?
If not the only workaround I can think of is to have to have a new playbook for each project with the project name hard-coded.

Best regards,
David

Matt Martz

unread,
Jan 14, 2015, 2:42:35 PM1/14/15
to ansible...@googlegroups.com
For tower related inquiries you will want to reach out to sup...@ansible.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/9fbf8537-9071-4e0c-b355-a7e78edc315f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Matt Martz
@sivel
sivel.net
Reply all
Reply to author
Forward
0 new messages