config – Lookup current Ansible configuration values¶
New in version 2.5.
Synopsis¶
- Retrieves the value of an Ansible configuration setting.
- You can use
ansible-config list
to see all available settings.
Parameters¶
Examples¶
- name: Show configured default become user
debug: msg="{{ lookup('config', 'DEFAULT_BECOME_USER')}}"
- name: print out role paths
debug:
msg: "These are the configured role paths: {{lookup('config', 'DEFAULT_ROLES_PATH')}}"
- name: find retry files, skip if missing that key
find:
paths: "{{lookup('config', 'RETRY_FILES_SAVE_PATH')|default(playbook_dir, True)}}"
patterns: "*.retry"
- name: see the colors
debug: msg="{{item}}"
loop: "{{lookup('config', 'COLOR_OK', 'COLOR_CHANGED', 'COLOR_SKIP', wantlist=True)}}"
- name: skip if bad value in var
debug: msg="{{ lookup('config', config_in_var, on_missing='skip')}}"
var:
config_in_var: UNKNOWN
Return Values¶
Common return values are documented here, the following are the fields unique to this lookup:
Key | Returned | Description |
---|---|---|
_raw
-
|
value(s) of the key(s) in the config
|
Status¶
- This lookup is not guaranteed to have a backwards compatible interface. [preview]
- This lookup is maintained by the Ansible Community. [community]
Authors¶
- Ansible Core
Hint
If you notice any issues in this documentation, you can edit this document to improve it.
Hint
Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.