--- - include_tasks: deb.yml when: ansible_distribution in ["Debian", "Ubuntu"] - include_tasks: el.yml when: ansible_distribution in ["CentOS", "Red Hat Enterprise Linux", "RedHat", "Fedora"] - name: print generated password for {{ create_username }} on each host debug: var=create_pwgen when: user_created is changed - name: copy current pubkeys to ~{{ create_username }}/.ssh/authorized_keys authorized_key: user: "{{ create_username }}" state: present key: "{{ item }}" with_items: - "{{ lookup('file','~/.ssh/id_ed25519.pub') }}" - "{{ lookup('file','~/.ssh/id_rsa.pub') }}" - "{{ lookup('file','~/.ssh/id_ecdsa.pub') }}"