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.
For more options, visit https://groups.google.com/d/optout.