--- - name: users hosts: all become: yes tasks: - name: make-me ansible.builtin.user: name: hogweed1 shell: /bin/bash create_home: yes # python -c 'import crypt; print crypt.crypt("This is my Password", "$1$SomeSalt$")' password: $6$KHOI$0Dq28VBwgtNFvfbQQ.4s6koctN6e5ZWRRBhWp0lkKKiel8y2qhc89E0CY479b4EX5.CnfDhS8rlaOATk/rXLu0 - name: Set authorized key taken from file ansible.posix.authorized_key: user: hogweed1 state: present key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINHTnXy693g6ivEJ6D5VrTBnjEjIe/a00cU7/9Hb79Zf hogweed1@vdk2ch.ru" - name: Make users passwordless for sudo in group wheel lineinfile: path: /etc/sudoers state: present regexp: '^%hogweed1' line: '%hogweed1 ALL=(ALL) NOPASSWD: ALL' validate: 'visudo -cf %s'