You forgot the output. Also, what is your high level goal. Why do you need to know if a user exists and has sudo permission.
On Wed, 20 May 2020 at 21:21, Jerry Jerry <[email protected]> wrote: > Trying to check if a user exists locally and if true, check to see if it > has sudo rights. I can't seem to process the second loop. I tried using > out.results.item but error: > > fatal: [hostname]: FAILED! => {"msg": "'list object' has no attribute > 'item'"} > > --- > - hosts: all > gather_facts: no > become: yes > tasks: > - name: check user exists > command: grep {{ item }} /etc/passwd > failed_when: False > register: out > with_items: > - user1 > - user2 > - user3 > > - debug: > var: out > > - name: check if existing user is in sudoers > command: grep {{ item }} /etc/sudoers > with_items: "{{ out.results }}" > register: message > > - debug: > var: message > > -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/780471fd-cc97-4a8d-930e-147784254c80%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/780471fd-cc97-4a8d-930e-147784254c80%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Sent from a mobile device - please excuse the brevity, spelling and punctuation. -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAL8fbwO4zNJ9UHEcmGaDMDZfwdVZZb%3DLVWY9LfnZzCXE_coEKA%40mail.gmail.com.
