I’ve setup ansible playbook to change password for Cisco nxos devices.
However, I keep getting the following warning message. Does anyone have any clue? or any experience to see the same issue?
##[section]Starting: Update NPA on NXOS devices for Specific Devices
`==============================================================================`
Generating script.
Script contents:
ansible-playbook /etc/ansible/playbooks/nxos/plb-nxos-secrets-admin.yml -i /etc/ansible/inventories/inv-test-for_nxos_with_password.yml
========================== Starting Command Output ===========================
PLAY [NXOS - Set password for local admin account] *****************************
TASK [Set password for local admin account] ************************************
[WARNING]: To ensure idempotency and correct diff the input configuration lines
should be similar to how they appear if present in the running configuration on
device
changed: [xxxxx-ooo-asw02]
PLAY RECAP *********************************************************************
xxxxx-ooo-asw02 : ok=1 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
##[error]Bash wrote one or more lines to the standard error stream.
##[error][WARNING]: To ensure idempotency and correct diff the input configuration lines
should be similar to how they appear if present in the running configuration on
device
##[section]Finishing: Update NPA on NXOS devices for Specific Devices
- name: NXOS - Set password for local admin account
hosts: nxos
gather_facts: false
tasks:
- name: Set password for local admin account
nxos_config:
lines:
- username admin password xxxxxxxxxx role network-admin
This WARNING message was sent to stderr instead of stdout, since Ansible sends any warning message to stderr.
TASK [Set password for local admin account] ************************************
[WARNING]: To ensure idempotency and correct diff the input configuration lines should be similar to how they appear if present in the running configuration on device
changed: [xxxxx-ooo-asw02]
So following error simply indicates that there were some output to stderr and dumps the contents of the stderr.
I assume you are using Azure Pipelines, but if the “Fail On Standard Error” option is false (default), I think you can ignore this error message.
##[error]Bash wrote one or more lines to the standard error stream.
##[error][WARNING]: To ensure idempotency and correct diff the input configuration lines should be similar to how they appear if present in the running configuration on device
AFAIK we can’t change this configuration in a playbook. As workarounds, we should consider changing this configuration via environment variable by some way.
We can use env for task (or bash, idk which is used on your side) for Azure pipelines:
However, regarding the second option, it worked perfectly!!! ANSIBLE_ACTION_WARNINGS=false ansible-playbook /etc/ansible/playbooks/nxos/plb-nxos-secrets-admin.yml -i /etc/ansible/inventories/inv-test-for_nxos_with_password.yml
For now, I’ll be using the second option, appending ANSIBLE_ACTION_WARNINGS=false in my script.