--- - name: Combine all managed users no_log: true # the ansible user's password_hash is in this list; set_fact prints it at -v ansible.builtin.set_fact: user_management_all_users: >- {{ [user_management_ansible_user] + user_management_other_users }} tags: always - name: Extract managed usernames ansible.builtin.set_fact: user_management_managed_usernames: >- {{ user_management_all_users | map(attribute='name') | list }} tags: always - name: Bootstrap access (optional) when: user_management_bootstrap ansible.builtin.import_tasks: bootstrap.yml tags: always - name: Manage system users ansible.builtin.import_tasks: create_users.yml tags: create_users - name: Set SSH keys for created users ansible.builtin.import_tasks: ssh_keys.yml tags: ssh_keys - name: Lock root's password (optional) when: user_management_lock_root_password ansible.builtin.import_tasks: lock_root.yml tags: lock_root_password - name: Hand the connection back to the configured user when: - user_management_bootstrap - user_management_connection is failed - not ansible_check_mode # nothing was created in check mode, so the user cannot log in yet ansible.builtin.import_tasks: handback.yml tags: always - name: Disable cloud-init management (if present) when: user_management_disable_cloud_init ansible.builtin.import_tasks: disable_cloud_init.yml tags: disable_cloud_init