Optimized different roles

This commit is contained in:
2022-03-17 16:28:57 +01:00
parent 99b66dda81
commit 3f37ee5c6c
5 changed files with 37 additions and 23 deletions

View File

@@ -1,6 +1,8 @@
- name: create sshd_config
copy:
src: sshd_config
template:
src: "sshd_config.j2"
dest: /etc/ssh/sshd_config
backup: yes
owner: root
group: root
mode: '0644'
notify: sshd restart

View File

@@ -108,7 +108,11 @@ PrintMotd no # pam does that
#Banner none
# override default of no subsystems
Subsystem sftp /usr/lib/ssh/sftp-server
{% if ansible_os_family == "Archlinux" %}
Subsystem sftp /usr/lib/ssh/sftp-server
{% else%}
Subsystem sftp /usr/lib/openssh/sftp-server
{% endif %}
# Example of overriding settings on a per-user basis
#Match User anoncvs

View File

@@ -1 +1,3 @@
command="/home/backup/ssh-wrapper.sh" {{authorized_keys}}
{% for authorized_key in authorized_keys_list %}
command="/home/backup/ssh-wrapper.sh" {{authorized_key}}
{% endfor %}

View File

@@ -1,2 +1,2 @@
authorized_keys_path: "{{ inventory_dir }}/files/{{ inventory_hostname }}/home/backup/.ssh/authorized_keys"
authorized_keys: "{{ lookup('file', authorized_keys_path) }}"
authorized_keys_list: "{{ lookup('file', authorized_keys_path).splitlines() }}"