2019-02-26 03:49:51 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
- include_tasks: deb.yml
|
|
|
|
when: ansible_distribution in ["Debian", "Ubuntu"]
|
|
|
|
|
|
|
|
- include_tasks: el.yml
|
2020-01-07 06:37:06 +00:00
|
|
|
when: ansible_distribution in ["CentOS", "Red Hat Enterprise Linux", "RedHat", "Fedora"]
|
2019-02-26 03:49:51 +00:00
|
|
|
|
|
|
|
- name: print generated password for {{ username }} on each host
|
|
|
|
debug: var=pwgen
|
|
|
|
when: user_created is changed
|
|
|
|
|
|
|
|
- name: copy current pubkeys to ~{{ username }}/.ssh/authorized_keys
|
|
|
|
authorized_key:
|
|
|
|
user: "{{ username }}"
|
|
|
|
state: present
|
|
|
|
key: "{{ item }}"
|
|
|
|
with_items:
|
|
|
|
- "{{ lookup('file','~/.ssh/id_ed25519.pub') }}"
|
|
|
|
- "{{ lookup('file','~/.ssh/id_rsa.pub') }}"
|