# Variable registration step, ignore\_errors, and idempotency

**URL:** <https://forum.ansible.com/t/variable-registration-step-ignore-errors-and-idempotency/15746>\
**Category:** Ansible Project\
**Created:** [July 23, 2014, 5:14pm UTC](https://forum.ansible.com/t/variable-registration-step-ignore-errors-and-idempotency/15746 "2014-07-23T17:14:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_VanGundy](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@Ryan\_VanGundy](https://forum.ansible.com/u/Ryan_VanGundy)\
**Post date:** [July 23, 2014, 5:14pm UTC](https://forum.ansible.com/t/variable-registration-step-ignore-errors-and-idempotency/15746/1 "2014-07-23T17:14:35Z")

</div>

I’m writing a playbook that runs an initial git commit on a folder if there has not yet been a commit. I check this using:

`

- name: Get commit count  
command: git rev-list HEAD --count chdir={{ project\_path }}  
ignore\_errors: yes  
register: git\_commit\_count

`

If there have been no commits, this command returns an error, in which case I then conditionally run a few other git-related steps. I have two issues with this:

1. Even if the error is ignored, it is still reported in the log display even if I have not enabled verbose mode
2. This step always reports “changed” which breaks my idempotency check that ensures changed=0 on a second run  
Is there a good way to work around this? Can I take this step “off the record”?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [July 23, 2014, 10:15pm UTC](https://forum.ansible.com/t/variable-registration-step-ignore-errors-and-idempotency/15746/2 "2014-07-23T22:15:32Z")

</div>

Instead of ignore\_errors: True, consider:

failed\_when: False

The reporting of changed always can be fixed with

changed\_when: False

---

<div class="post-metadata">

**Author:** ![Ryan\_VanGundy](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@Ryan\_VanGundy](https://forum.ansible.com/u/Ryan_VanGundy)\
**Post date:** [July 24, 2014, 5:25pm UTC](https://forum.ansible.com/t/variable-registration-step-ignore-errors-and-idempotency/15746/3 "2014-07-24T17:25:17Z")

</div>

Perfect, exactly what I needed. Thanks!
