Skip to content

Instantly share code, notes, and snippets.

@antoinell
Last active September 4, 2018 19:44
Show Gist options
  • Save antoinell/60c101cde44b0967bc82a78f74f9b895 to your computer and use it in GitHub Desktop.
Save antoinell/60c101cde44b0967bc82a78f74f9b895 to your computer and use it in GitHub Desktop.
ansible how to evaluate a string in a vars file
- permissions:
{{"{% for item in groups['ingestion'] %}
- 'vhost': {{'/' + item.split('.')[0]}} ,
'configure_priv': '.*' ,
'read_priv': '.*' ,
'write_priv': '.*'
{% endfor %}" | from_yaml}}
The above does not seem to do what is desired.
Which would be to generate something like :
- permissions:
- vhost: /aws-replica001
configure_priv: .*
read_priv: .*
write_priv: .*
- vhost: /aws-replica004
configure_priv: .*
read_priv: .*
write_priv: .*
- vhost: /aws-replica005
configure_priv: .*
read_priv: .*
write_priv: .*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment