-
-
Save jamesdube/6da0806c2b9248fe29f73ce17ac5e49a to your computer and use it in GitHub Desktop.
ansible - example of dict with array of arrays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PLAY [foo] ******************************************************************** | |
GATHERING FACTS *************************************************************** | |
ok: [localhost] | |
TASK: [role1 | debug var=redis] *********************************************** | |
ok: [localhost] => { | |
"redis": { | |
"database_save_times": [ | |
[ | |
900, | |
1 | |
], | |
[ | |
300, | |
10 | |
], | |
[ | |
60, | |
10000 | |
] | |
] | |
} | |
} | |
TASK: [role1 | template dest=/tmp/foo src=foo.j2] ***************************** | |
changed: [localhost] | |
PLAY RECAP ******************************************************************** | |
localhost : ok=3 changed=1 unreachable=0 failed=0 | |
[root@foo ansible]# cat /tmp/foo | |
save 900 1 | |
save 300 10 | |
save 60 10000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: foo | |
roles: | |
- role1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
redis: | |
database_save_times: | |
- [900, 1] | |
- [300, 10] | |
- [60, 10000] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- debug: var=redis | |
- template: dest=/tmp/foo src=foo.j2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for i in redis.database_save_times %} | |
save {{ i[0] }} {{ i[1] }} | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment