diff --git a/defaults/main.yaml b/defaults/main.yaml index 5b16aee..9e1aff2 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -21,3 +21,6 @@ ssh_key_private_filename: id_rsa ssh_key_public_content: ssh_key_public_filename: id_rsa.pub + +ssh_known_hosts_content: +ssh_known_hosts_filename: known_hosts diff --git a/tasks/config.yaml b/tasks/config.yaml index 2ffbb70..6992632 100644 --- a/tasks/config.yaml +++ b/tasks/config.yaml @@ -20,6 +20,15 @@ owner: "{{ ssh_user_name }}" state: directory +- name: Create ssh known_hosts file. + copy: + content: "{{ ssh_known_hosts_content }}" + dest: "{{ ssh_user_home }}/.ssh/{{ ssh_known_hosts_filename }}" + group: "{{ ssh_user_group }}" + mode: 0644 + owner: "{{ ssh_user_name }}" + when: ssh_known_hosts_content + - name: Create ssh private key. copy: content: "{{ ssh_key_private_content }}"