Last active
March 8, 2018 12:27
-
-
Save anryko/a93fa477e3aafccfc6b1d9a991e34b76 to your computer and use it in GitHub Desktop.
Andible filter env vars for docker.
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
- set_fact: | |
set_filter: 'aws_' | |
# set_envs: [{ 'AWS_PROFILE': <value>}, {'AWS_REGION': <value>}, ...] | |
- set_fact: | |
set_envs: "{{ set_envs | d([]) | union([{ item.split('=', 1)[0]: item.split('=', 1)[1] }]) }}" | |
when: item.startswith(set_filter | upper) | |
with_items: "{{ lookup('pipe', 'env').split('\n') }}" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment