Files
computer-playbook/roles/user-root/tasks/02_ssh.yml
T

28 lines
674 B
YAML

- name: "Include SSH for user root"
include_role:
name: 'sys-svc-ssh'
when: not (run_once_sys_svc_ssh | default(false) | bool)
- name: Ensure '{{ USER_ROOT_SSH_DIR }}' exists
file:
path: "{{ USER_ROOT_SSH_DIR }}"
state: directory
owner: root
group: root
mode: '0700'
- name: Generate a SSH key for root if it does not exist
community.crypto.openssh_keypair:
path: "{{ USER_ROOT_SSH_KEY_PRIVATE }}"
type: rsa
size: 4096
- name: Display the public SSH key
command: "cat {{ USER_ROOT_SSH_KEY_PUBLIC }}"
register: public_key
changed_when: false
- name: Output the public SSH key
debug:
msg: "{{ public_key.stdout }}"