$ vim user-ssh-key.yaml --- - name: Manage user accounts hosts: all tasks: - name: Add user user: name: suporte comment: "Suporte User" shell: /bin/bash state: present - name: Set authorized SSH key authorized_key: user: suporte state: present key: "{{ lookup('file', './suporte.pub') }}" - name: Add SUDO lineinfile: path: /etc/sudoers.d/suporte line: "suporte ALL=(ALL) NOPASSWD:ALL" state: present mode: 0440 create: yes validate: '/usr/sbin/visudo -cf %s'