diff --git a/changelogs/fragments/ansible-env-config-prefix.yml b/changelogs/fragments/ansible-env-config-prefix.yml new file mode 100644 index 00000000000..dac98712bff --- /dev/null +++ b/changelogs/fragments/ansible-env-config-prefix.yml @@ -0,0 +1,20 @@ +--- +minor_changes: +- | + All environment variables defined by ansible now start with the `ANSIBLE_` + prefix. The old environment vars still work for now. + + The new environment vars added are: + - ANSIBLE_LIBVIRT_LXC_NOSECLABEL + - ANSIBLE_DISPLAY_SKIPPED_HOSTS + - ANSIBLE_NETWORK_GROUP_MODULES + +deprecated_features: +- | + Ansible-defined environment variables not starting with `ANSIBLE_` have been + deprecated. New names match the old name plus the `ANSIBLE_` prefix. + + These environment variables have been deprecated: + - LIBVIRT_LXC_NOSECLABEL + - DISPLAY_SKIPPED_HOSTS + - NETWORK_GROUP_MODULES diff --git a/lib/ansible/config/base.yml b/lib/ansible/config/base.yml index 457ff60b4b5..8205ac369ec 100644 --- a/lib/ansible/config/base.yml +++ b/lib/ansible/config/base.yml @@ -762,7 +762,13 @@ DEFAULT_LIBVIRT_LXC_NOSECLABEL: description: - "This setting causes libvirt to connect to lxc containers by passing --noseclabel to virsh. This is necessary when running on systems which do not have SELinux." - env: [{name: LIBVIRT_LXC_NOSECLABEL}] + env: + - name: LIBVIRT_LXC_NOSECLABEL + deprecated: + why: environment variables without "ANSIBLE_" prefix are deprecated + version: "2.12" + alternatives: the "ANSIBLE_LIBVIRT_LXC_NOSECLABEL" environment variable + - name: ANSIBLE_LIBVIRT_LXC_NOSECLABEL ini: - {key: libvirt_lxc_noseclabel, section: selinux} type: boolean @@ -1305,7 +1311,13 @@ DISPLAY_SKIPPED_HOSTS: name: Show skipped results default: True description: "Toggle to control displaying skipped task/host entries in a task in the default callback" - env: [{name: DISPLAY_SKIPPED_HOSTS}] + env: + - name: DISPLAY_SKIPPED_HOSTS + deprecated: + why: environment variables without "ANSIBLE_" prefix are deprecated + version: "2.12" + alternatives: the "ANSIBLE_DISPLAY_SKIPPED_HOSTS" environment variable + - name: ANSIBLE_DISPLAY_SKIPPED_HOSTS ini: - {key: display_skipped_hosts, section: defaults} type: boolean @@ -1594,7 +1606,13 @@ NETWORK_GROUP_MODULES: name: Network module families default: [eos, nxos, ios, iosxr, junos, enos, ce, vyos, sros, dellos9, dellos10, dellos6, asa, aruba, aireos, bigip, ironware, onyx, netconf] description: 'TODO: write it' - env: [{name: NETWORK_GROUP_MODULES}] + env: + - name: NETWORK_GROUP_MODULES + deprecated: + why: environment variables without "ANSIBLE_" prefix are deprecated + version: "2.12" + alternatives: the "ANSIBLE_NETWORK_GROUP_MODULES" environment variable + - name: ANSIBLE_NETWORK_GROUP_MODULES ini: - {key: network_group_modules, section: defaults} type: list diff --git a/lib/ansible/plugins/callback/actionable.py b/lib/ansible/plugins/callback/actionable.py index 0612c407bdd..4d837e46adc 100644 --- a/lib/ansible/plugins/callback/actionable.py +++ b/lib/ansible/plugins/callback/actionable.py @@ -31,6 +31,11 @@ DOCUMENTATION = ''' default: no env: - name: DISPLAY_SKIPPED_HOSTS + deprecated: + why: environment variables without "ANSIBLE_" prefix are deprecated + version: "2.12" + alternatives: the "ANSIBLE_DISPLAY_SKIPPED_HOSTS" environment variable + - name: ANSIBLE_DISPLAY_SKIPPED_HOSTS ini: - key: display_skipped_hosts section: defaults diff --git a/lib/ansible/plugins/doc_fragments/default_callback.py b/lib/ansible/plugins/doc_fragments/default_callback.py index c62392f6cec..c3c4178a5ab 100644 --- a/lib/ansible/plugins/doc_fragments/default_callback.py +++ b/lib/ansible/plugins/doc_fragments/default_callback.py @@ -15,6 +15,11 @@ class ModuleDocFragment(object): default: yes env: - name: DISPLAY_SKIPPED_HOSTS + deprecated: + why: environment variables without "ANSIBLE_" prefix are deprecated + version: "2.12" + alternatives: the "ANSIBLE_DISPLAY_SKIPPED_HOSTS" environment variable + - name: ANSIBLE_DISPLAY_SKIPPED_HOSTS ini: - key: display_skipped_hosts section: defaults diff --git a/test/integration/targets/callback_default/runme.sh b/test/integration/targets/callback_default/runme.sh index d6a72407b68..c956ab89030 100755 --- a/test/integration/targets/callback_default/runme.sh +++ b/test/integration/targets/callback_default/runme.sh @@ -85,38 +85,38 @@ export ANSIBLE_FORCE_COLOR=0 export ANSIBLE_NOCOLOR=1 # Default settings -export DISPLAY_SKIPPED_HOSTS=1 +export ANSIBLE_DISPLAY_SKIPPED_HOSTS=1 export ANSIBLE_DISPLAY_OK_HOSTS=1 export ANSIBLE_DISPLAY_FAILED_STDERR=0 run_test default # Hide skipped -export DISPLAY_SKIPPED_HOSTS=0 +export ANSIBLE_DISPLAY_SKIPPED_HOSTS=0 run_test hide_skipped # Hide skipped/ok -export DISPLAY_SKIPPED_HOSTS=0 +export ANSIBLE_DISPLAY_SKIPPED_HOSTS=0 export ANSIBLE_DISPLAY_OK_HOSTS=0 run_test hide_skipped_ok # Hide ok -export DISPLAY_SKIPPED_HOSTS=1 +export ANSIBLE_DISPLAY_SKIPPED_HOSTS=1 export ANSIBLE_DISPLAY_OK_HOSTS=0 run_test hide_ok # Failed to stderr -export DISPLAY_SKIPPED_HOSTS=1 +export ANSIBLE_DISPLAY_SKIPPED_HOSTS=1 export ANSIBLE_DISPLAY_OK_HOSTS=1 export ANSIBLE_DISPLAY_FAILED_STDERR=1 run_test failed_to_stderr # Default settings with unreachable tasks -export DISPLAY_SKIPPED_HOSTS=1 +export ANSIBLE_DISPLAY_SKIPPED_HOSTS=1 export ANSIBLE_DISPLAY_OK_HOSTS=1 export ANSIBLE_DISPLAY_FAILED_STDERR=1