Add authorized_keys support

It is possible people also want to setup the .ssh/authorized_keys file.

Change-Id: I039f5b866192bb5309bff23f4811cdf83ba859af
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2019-01-26 18:41:28 -05:00
parent c7f8d4154e
commit 1e1255a1fa
3 changed files with 18 additions and 0 deletions

View File

@ -21,6 +21,10 @@ ssh_user_name:
ssh_user_home: "/home/{{ ssh_user_name }}"
ssh_user_group: "{{ ssh_user_name }}"
ssh_authorized_keys_content:
ssh_authorized_keys_dest: "{{ ssh_user_home }}/.ssh/authorized_keys"
ssh_authorized_keys_src: authorized_keys.j2
ssh_key_private_content:
ssh_key_private_dest: "{{ ssh_user_home }}/.ssh/id_rsa"
ssh_key_private_src: id_rsa.j2

View File

@ -21,6 +21,16 @@
owner: "{{ ssh_user_name }}"
state: directory
- name: Create ssh authorized_keys file
become: yes
template:
dest: "{{ ssh_authorized_keys_dest }}"
group: "{{ ssh_user_group }}"
mode: 0600
owner: "{{ ssh_user_name }}"
src: "{{ ssh_authorized_keys_src }}"
when: ssh_authorized_keys_content | default(False)
- name: Create ssh known_hosts file
become: yes
template:

View File

@ -0,0 +1,4 @@
# This file is generated by Ansible
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
#
{{ ssh_authorized_keys_content }}