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

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

For tower related inquiries you will want to reach out to support@ansible.com