I forgot to mention I´m using Ansible 1.6.6.
solved it now after cleaning my eyes:-)
Variables can be accessed within the template - if the spelling of the
variable is correct. I missed one character in a
very_long_variable_name_with_some_underscores - and that causes the
problem.
It 1st looked like the variable isn´t properly passed to the template.
Sorry for that,
Torsten
Am Mittwoch, 17. Dezember 2014 16:47:17 UTC+1 schrieb Torsten Reinhard:
>
> Hi,
>
> I have a playbook like:
>
> ---
> ...
> vars_files:
> - vars/stage-{{stage}}.yml
> - vars/extint/stage-{{stage}}.yml
>
> roles:
> - { role: extint, params: "{{ extint_instance }}" }
> ...
>
>
>
> Inside the role "extint" I have this task, processing a template in a loop
>
> ...
> - name: create generate {{env_name}}/env.properties
> template: src=./env.properties.j2 dest=/path/to/config_generated/system
> /{{env_name}}{{ item.index }}/env.properties
> with_items: params
> tags: generate_resources
> ...
>
>
> Now my problem is that all (global) variables that are read from the
> playbook ( -vars/extint/stage-{{stage}}.yml ) are not accessible in the
> template.
>
> How can I loop over a list of items, process a template for each item -
> and access common variables in the template ? Do I need to pass the
> ansible_managed variables explicitely to the template somehow ?
>
> Thanx, Torsten
>
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/7db4357c-a316-4cb6-b504-411aac64307f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.