consider the following variable:
to_be_removed_users:
- name: 'adm'
remove: False
- name: 'ftp'
remove: True
- name: 'games'
remove: False
- name: 'gopher'
remove: True
- name: 'operator'
remove: False
- name: 'uucp'
remove: True
then the following tasks generate the warning. Not sure how to avoid it as item.name is the result of iteration on the list
name: Get users list
getent:
database: passwd
tags:
- userdel
- name: Make sure the following users are removed
user:
name: "{{ item.name }}"
state: absent
remove: "{{item.remove}}"
with_items: '{{ to_be_removed_users }}'
when: getent_passwd.{{ item.name }} is defined
tags:
- userdel
--
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 ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAB1FMuSpS4VKk80KQXdJku6GJdWHrKQQQ4tJLqbLZmEXcbaeTg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
when: getent_passwd[item['name']] is defined
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAD8N0v90HvhfX0MLtXZgEAj26gxS%3DD_gTEkFUwRsEj6KXQdw1Q%40mail.gmail.com.