- name: install mandatory python for encrypt password dnf: name: [python3, python3-bcrypt] state: present - name: create password for user kadmin shell: python -c 'import crypt;hashed = crypt.crypt("{{ gilles_passwd }}"); print(hashed);' register: passwd - name: create user kadmin user: name: gilles comment: Gilles Mouchet password: "{{ passwd.stdout }}" - name: copy sudo file lineinfile: path: /etc/sudoers.d/gilles create: true insertbefore: EOF line: 'gilles ALL=(ALL) NOPASSWD: ALL'