Created
November 10, 2017 11:39
-
-
Save danrough/42b34bd87bd3d2aee9367f9a98596468 to your computer and use it in GitHub Desktop.
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: localhost | |
gather_facts: no | |
vars: | |
database_clusters: | |
- { cluster_name: "test_lon", port: 5433 } | |
- { cluster_name: "prod_lon", port: 5434 } | |
tasks: | |
- name: Port for {{ environment }}_{{ region | lower }} | |
debug: var="{{ database_clusters | selectattr('cluster_name', 'equalto', '{{ environment }}_{{ region | lower }}') | map(attribute='port') | join(',') }}" | |
# To run: | |
# ansible-playbook ./dictionary-lookup.yml --extra-vars="environment=test region=LON" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment