# override "changed:" variable from within a shell?

**URL:** <https://forum.ansible.com/t/override-changed-variable-from-within-a-shell/12647>\
**Category:** Ansible Project\
**Created:** [April 8, 2013, 11:25am UTC](https://forum.ansible.com/t/override-changed-variable-from-within-a-shell/12647 "2013-04-08T11:25:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PJ1](https://avatars.discourse-cdn.com/v4/letter/p/eb8c5e/32.png) [@PJ1](https://forum.ansible.com/u/PJ1)\
**Post date:** [April 8, 2013, 11:25am UTC](https://forum.ansible.com/t/override-changed-variable-from-within-a-shell/12647/1 "2013-04-08T11:25:30Z")

</div>

Hi,

It’s possible to change the outcome (RC) of a shell command with the exit command, but is there a way to override the changed-variable?  
command: sh -c “[! -h /etc/ldap.conf -a -e /etc/ldap.conf] && mv /etc/ldap.conf /etc/ldap.conf.orig || exit 0”

PJ

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [April 8, 2013, 3:46pm UTC](https://forum.ansible.com/t/override-changed-variable-from-within-a-shell/12647/2 "2013-04-08T15:46:12Z")

</div>

There have been a few proposals to provide a parameter to the command module like “changed\_rc” that accepted a range of return codes that would be interpreted as unchanged/changed or so, but nothing yet that supported a range of return codes.

You can choose to not key off the changed attribute and instead do a conditional based on the rc or output.
