# Format for conditional password change

**URL:** <https://forum.ansible.com/t/format-for-conditional-password-change/22068>\
**Category:** Ansible Project\
**Created:** [July 20, 2016, 10:09pm UTC](https://forum.ansible.com/t/format-for-conditional-password-change/22068 "2016-07-20T22:09:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ian\_Dennison](https://avatars.discourse-cdn.com/v4/letter/i/e47c2d/32.png) [@Ian\_Dennison](https://forum.ansible.com/u/Ian_Dennison)\
**Post date:** [July 20, 2016, 10:09pm UTC](https://forum.ansible.com/t/format-for-conditional-password-change/22068/1 "2016-07-20T22:09:31Z")

</div>

Am creating a playbook where the password age is set to 0 on userid create. The variable “user\_created” gets detected as “changed” when a deleted userid is already deleted (ie, has “absent” in the item.state), so I am trying to work around this by putting a double conditional in the “users set passwd age on add” task. However ansible will not let me reference the item.state variable in any way, shape or form. I have tried “with quotes”, “with brackets”, “without quotes and with brackets”, “with quoutes and without brackets”.

Question 1: Is the “changed” attribute being set when no user was actually removed a bug in the module?

Question 2: What is the syntax for referencing item.state in a conditional?

# tasks file for user

---

<div class="post-metadata">

**Author:** ![Ian\_Dennison](https://avatars.discourse-cdn.com/v4/letter/i/e47c2d/32.png) [@Ian\_Dennison](https://forum.ansible.com/u/Ian_Dennison)\
**Post date:** [July 25, 2016, 8:50pm UTC](https://forum.ansible.com/t/format-for-conditional-password-change/22068/2 "2016-07-25T20:50:00Z")

</div>

Anybody? Bueller? Bueller?

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [July 27, 2016, 5:40am UTC](https://forum.ansible.com/t/format-for-conditional-password-change/22068/3 "2016-07-27T05:40:58Z")

</div>

Never use curly brackets in when:, they are implied.
