# \[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?

**URL:** <https://forum.ansible.com/t/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/3061>\
**Category:** Get Help\
**Tags:** azure, playbook, collections, ansible-core\
**Created:** [December 25, 2023, 7:12am UTC](https://forum.ansible.com/t/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/3061 "2023-12-25T07:12:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![bacchus21](https://avatars.discourse-cdn.com/v4/letter/b/bbe5ce/32.png) [@bacchus21](https://forum.ansible.com/u/bacchus21)\
**Post date:** [December 25, 2023, 7:12am UTC](https://forum.ansible.com/t/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/3061/1 "2023-12-25T07:12:54Z")

</div>

Hello, All

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?

```auto
##[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

```

```auto
[root@ansible001 ~]# ansible --version
ansible [core 2.15.6]

NAME="Red Hat Enterprise Linux"
VERSION="9.3 (Plow)"

```

```auto
- my playbook code!

```

```auto
- 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

```

Thank you in advance for looking at this issue.

Regards

---

<div class="post-metadata">

**Author:** ![akira6592](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/akira6592/32/222_2.png) [@akira6592](https://forum.ansible.com/u/akira6592)\
**Post date:** [December 25, 2023, 11:22am UTC](https://forum.ansible.com/t/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/3061/2 "2023-12-25T11:22:29Z")

</div>

Hello @bacchus21

The nxos\_config module displays a warning when changes occur.

If it is for user management, the nxos\_user module may be more suitable.  
[https://docs.ansible.com/ansible/latest/collections/cisco/nxos/nxos\_user\_module.html](https://docs.ansible.com/ansible/latest/collections/cisco/nxos/nxos_user_module.html)

---

<div class="post-metadata">

**Author:** ![bacchus21](https://avatars.discourse-cdn.com/v4/letter/b/bbe5ce/32.png) [@bacchus21](https://forum.ansible.com/u/bacchus21)\
**Post date:** [December 26, 2023, 12:41am UTC](https://forum.ansible.com/t/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/3061/3 "2023-12-26T00:41:34Z")

</div>

Hello, @akira6592

Thank you very much for looking at my question. However, looks like nxos\_user is a bit different from my case.

By the way, do you have any clue why below error appears?  
`##[error]Bash wrote one or more lines to the standard error stream.`

Regards

---

<div class="post-metadata">

**Author:** ![akira6592](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/akira6592/32/222_2.png) [@akira6592](https://forum.ansible.com/u/akira6592)\
**Post date:** [December 27, 2023, 11:37am UTC](https://forum.ansible.com/t/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/3061/4 "2023-12-27T11:37:06Z")

</div>

@bacchus21 Sorry, I do not know the cause of that error.

---

<div class="post-metadata">

**Author:** ![kurokobo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kurokobo/32/182_2.png) [@kurokobo](https://forum.ansible.com/u/kurokobo)\
**Post date:** [December 27, 2023, 2:03pm UTC](https://forum.ansible.com/t/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/3061/5 "2023-12-27T14:03:27Z")

</div>

Hi,

This `WARNING` message was sent to stderr instead of stdout, since Ansible sends any warning message to stderr.

> ```auto
> 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.

> ```auto
> ##[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
> 
> ```

If you want to hide any `WARNING`s from tasks, you can set `ANSIBLE_ACTION_WARNINGS=false` environment variable or add `action_warnings = false` to `ansible.cfg`: [Ansible Configuration Settings — Ansible Documentation](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#action-warnings)

---

<div class="post-metadata">

**Author:** ![bacchus21](https://avatars.discourse-cdn.com/v4/letter/b/bbe5ce/32.png) [@bacchus21](https://forum.ansible.com/u/bacchus21)\
**Post date:** [December 28, 2023, 3:09am UTC](https://forum.ansible.com/t/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/3061/6 "2023-12-28T03:09:37Z")

</div>

@kurokobo Thank you very much for your advice. Indeed, `action_warnings = false` to `ansible.cfg` works perfectly fine.

I need one more advice. Can we set the same in playbook so that this change only affect on specific playbooks?

Thank you.  
Regards

---

<div class="post-metadata">

**Author:** ![bacchus21](https://avatars.discourse-cdn.com/v4/letter/b/bbe5ce/32.png) [@bacchus21](https://forum.ansible.com/u/bacchus21)\
**Post date:** [December 28, 2023, 3:10am UTC](https://forum.ansible.com/t/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/3061/7 "2023-12-28T03:10:06Z")

</div>

@akira6592 Noted. Thank you very much!

---

<div class="post-metadata">

**Author:** ![kurokobo](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kurokobo/32/182_2.png) [@kurokobo](https://forum.ansible.com/u/kurokobo)\
**Post date:** [December 28, 2023, 2:32pm UTC](https://forum.ansible.com/t/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/3061/8 "2023-12-28T14:32:16Z")

</div>

> [@bacchus21](#):
>
> Can we set the same in playbook so that this change only affect on specific playbooks?

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:

```yaml
steps:
  - bash: ...
    env:
      ANSIBLE_ACTION_WARNINGS: "false"
  - task: ...
    env:
      ANSIBLE_ACTION_WARNINGS: "false"

```

Or to respect bash way, append `ANSIBLE_ACTION_WARNINGS=false` just before `ansible-playbook` in your script:

```bash
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

```

---

<div class="post-metadata">

**Author:** ![bacchus21](https://avatars.discourse-cdn.com/v4/letter/b/bbe5ce/32.png) [@bacchus21](https://forum.ansible.com/u/bacchus21)\
**Post date:** [December 29, 2023, 2:12am UTC](https://forum.ansible.com/t/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/3061/9 "2023-12-29T02:12:24Z")

</div>

@kurokobo Thank you very much for your advice.

I tried both “env” and “apend” options.

Regarding the below method, it causes some unexpected pipeline error, so I wasn’t able to proceed further.

```auto
steps:
  - bash: ...
    env:
      ANSIBLE_ACTION_WARNINGS: "false"
  - task: ...
    env:
      ANSIBLE_ACTION_WARNINGS: "false"

```

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.

Thank you again for helping me on this issue.

Regards
