Created
September 1, 2020 11:07
-
-
Save beddari/0ac2558f024ea500fcc95cfb6fb383b9 to your computer and use it in GitHub Desktop.
Role authors, don't do this in your role
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
# If you specify a variable for users to set outside your role | |
# DO NOT overwrite it later. | |
# | |
# Due to precedence rules the combined value here will | |
# never be set in some cases, e.g when using include_role | |
# | |
- name: Set netbox_config.SECRET_KEY to generated SECRET_KEY | |
set_fact: | |
netbox_config: "{{ netbox_config | combine({'SECRET_KEY': _netbox_secret_key_file['content'] | b64decode}) }}" | |
# Instead, use an "internal variable" if you need to do combines or similar | |
- name: Set netbox_config.SECRET_KEY to generated SECRET_KEY | |
set_fact: | |
_netbox_config: "{{ netbox_config | combine({'SECRET_KEY': _netbox_secret_key_file['content'] | b64decode}) }}" | |
# Use the internal fact from this point ... | |
# Pretty? No. Does it work? Yes. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment