Kevin Raison
2015-07-17 23:32:12 UTC
Hello, group. I am still a novice with Ansible, so perhaps my approach is
flawed, so if there is a better way, I am happy to hear about it. I have a
situation where I need to accumulate values into an Ansible list variable
on a role-by-role basis, and then use the contents of that list in another
role in order to populate a config file template. So, suppose I have these
roles:
- roles:
- service1
- service2
- service3
- make-config-file
And a variable 'services'. I would like to end up with services having a
value of [ service1, service2, service3 ] by the time 'make-config-file' is
executed so that it can write those values out to the config file.
So, the question is, how do I push a value onto the 'services' list in each
role? I understand how to get the values from the list into the config
file, I am just not sure how to accumulate a list in Ansible.
Thanks,
Kevin
flawed, so if there is a better way, I am happy to hear about it. I have a
situation where I need to accumulate values into an Ansible list variable
on a role-by-role basis, and then use the contents of that list in another
role in order to populate a config file template. So, suppose I have these
roles:
- roles:
- service1
- service2
- service3
- make-config-file
And a variable 'services'. I would like to end up with services having a
value of [ service1, service2, service3 ] by the time 'make-config-file' is
executed so that it can write those values out to the config file.
So, the question is, how do I push a value onto the 'services' list in each
role? I understand how to get the values from the list into the config
file, I am just not sure how to accumulate a list in Ansible.
Thanks,
Kevin
--
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+***@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/f95cfbd7-e97f-4d50-93af-9bd62d730e6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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+***@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/f95cfbd7-e97f-4d50-93af-9bd62d730e6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.