On Mon, 14 Dec 2020 06:37:05 -0800 (PST)
Jost Rakovec <[email protected]> wrote:

> ... lock list of users on linux only if user exist

Try this

    - name: Get passwd 
      getent:  
        database: passwd 
 
    - name: lock 
      user: 
        name: "{{ item }}" 
        password_lock: yes 
      loop: "{{ getent_passwd|intersect(my_users) }}"
      vars:
        my_users:
          - uporabnik1 
          - uporabnik2 
          - uporabnik3 
          - uporabnik4 
          - uporabnik5 

-- 
Vladimir Botka

-- 
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/20201214165506.5c728188%40gmail.com.

Attachment: pgpz_X_N6B8hl.pgp
Description: OpenPGP digital signature

Reply via email to