Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save antoinell/465578461c2765f97ac97e31d21aa348 to your computer and use it in GitHub Desktop.
Save antoinell/465578461c2765f97ac97e31d21aa348 to your computer and use it in GitHub Desktop.
I am trying to create this data structure in ansible.
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: .*
#
# my code
#
- name: set permissions
set_fact:
perms: "{{ groups['ingestion'] | map ({'vhost' : item}) | list }}"
#
# result at runtime
#
TASK [rabbitmq : set permissions] **********************************************************************************************************************************************
fatal: [aws-dbtest.dev.thesyscat.com]: FAILED! => {"msg": "Unexpected templating type error occurred on ({{ groups['ingestion'] | map ({'vhost' : item}) | list }}): unhashable type: 'dict'"}
@antoinell
Copy link
Author

I am told this fails because the map filter can only take another filter as argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment