Hi all,
I am new to Ansible and I am trying use the template module to create
different config files.
Here is what I got:
├── group_vars
│ └── web
└── web
├── tasks
│ └── main.yml
└── templates
└── virtualhost.conf
group_vars/web:
domain:
- alpha
- bravo
- charly
/web/tasks/main.yml:
- name: 7. Add Template Module
template: src=virtualhost.conf
dest=/etc/apache2/sites-available/{{domain}}.conf
with_items: domain
I want, that the task creates a file for each array field in the domain
list. So, what I expect are three files, named alpha.conf beta.conf and
charly.conf. But I just got one file, called ['alpha', 'bravo',
'charly'].conf
Job message:
src=virtualhost.conf dest=/etc/apache2/sites-available/['alpha', 'bravo',
'charly'].conf
When I use
with_items:
- alpha
- bravo
- charly
in the task itself, it works. But I want to declare the array in a separate
file (groupvar).
Can you tell my how to fix this?
Kind regards,
Amoyensis
--
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/ffb18b94-2281-45f8-b44f-1e2e402a448f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.