There is nothing called "not_changed_when" so you are making syntax up that
won't work :)

It seems you want to say

      changed_when: "result.state == 'absent'"

However this also seems excessive, because the default state of the module
should be to return unchanged if it didn't make any changes.

Ergo, changed_when can be omitted.

If you are having an error when deleting a pre-deleted user, this won't
help anyway, and I'd like more info.  Please include the output of running
this step with "-v", unfiltered, rather than just showing the middle of it,
and let me know your OS and ansible version.

Thanks!



On Wed, Jul 2, 2014 at 2:44 PM, Kenton Brede <[email protected]> wrote:

> Trying to learn more about how to use Ansible.  I've got a situation where
> a mix of local and LDAP users may exist on a box.  In some situations user1
> may either be a local user or LDAP user.
>
> I created a task to remove certain users.  The LDAP users are always
> marked as "changed" when obviously they aren't.  Is there a way to modify
> the report to say "ok?"
>
> I know how to do this with "command:" but not "user:."
>
> I get "error while evaluating conditional" when using, changed_when:
> "result.state != absent"
>
> Running debug on "result" shows LDAP users have state=absent:
>
>                 "item": "user1",
>                 "name": "user1",
>                 "remove": false,
>                 "shell": "/bin/bash",
>                 "state": "absent",
>                 "stderr": "userdel: error deleting password
> entry\nuserdel: error deleting shadow password entry\n",
>
> What I'd like to do is something like: not_changed_when: "result.state ==
> absent"
>
> Is there anyway to translate that into something that would work?
>
> Thanks,
> Kent
>
>
>  tasks:
>     - name: remove users
>       user: name={{ item }} state=absent
>       register: result
>       not_changed_when: "result.state != absent"
>       with_items:
>         - local-user1
>         - ldap-user1
>         - ldap-user2
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/d3ff467f-cd91-4c76-bd66-8016739bdcda%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/d3ff467f-cd91-4c76-bd66-8016739bdcda%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgwRhzBwrnoSMu7PfFeAXXZOGqLicDydou9_phQ%3Djeaa6Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to