update...

This commit is contained in:
2022-02-21 02:35:36 +01:00
parent 01f489e90d
commit 4d0d3b0d69
2 changed files with 59 additions and 30 deletions

View File

@ -10,31 +10,44 @@
fact_sshd_kexalgorithms: "{{ sshd_kexalgorithms | join (',') }}"
when:
- sshd_kexalgorithms is defined and sshd_kexalgorithms | length > 0
tags:
- sshd-config
- name: (sshd.yml) Set fact_sshd_ciphers (comma separated list)
set_fact:
fact_sshd_ciphers: "{{ sshd_ciphers | join (',') }}"
when:
- sshd_ciphers is defined and sshd_ciphers | length > 0
tags:
- sshd-config
- name: (sshd.yml) Set fact_sshd_macs
- name: (sshd.yml) Set fact_sshd_macs
set_fact:
fact_sshd_macs: "{{ sshd_macs | join (',') }}"
when:
- sshd_macs is defined and sshd_macs | length > 0
tags:
- sshd-config
- name: (sshd.yml) Set fact_sshd_hostkeyalgorithms (blank separated list)
set_fact:
fact_sshd_hostkeyalgorithms: "{{ sshd_hostkeyalgorithms | join (',') }}"
when:
- sshd_hostkeyalgorithms is defined and sshd_hostkeyalgorithms | length > 0
tags:
- sshd-config
- name: (sshd.yml) Set fact_sshd_allowed_users (blank separated list)
set_fact:
fact_sshd_allowed_users: "{{ sshd_allowed_users | join (' ') }}"
when:
- sshd_allowed_users is defined and sshd_allowed_users | length > 0
tags:
- sshd-config
# ---
# Create new sshd_config
# ---
- name: (sshd.yml) Check file '/etc/ssh/sshd_config.ORIG' exists
stat:
@ -49,6 +62,23 @@
tags:
- sshd-config
- name: (sshd.yml) Create new sshd_config from template sshd_config.j2
template:
src: etc/ssh/sshd_config.j2
dest: /etc/ssh/sshd_config
owner: root
group: root
mode: 0644
validate: 'sshd -f %s -T'
#backup: yes
notify: "Restart ssh"
when:
- ansible_facts['distribution'] == "Ubuntu"
tags:
- sshd-config
- name: (sshd.yml) Create/Update new sshd_config from template sshd_config.j2
template:
src: etc/ssh/sshd_config.j2
@ -59,7 +89,7 @@
validate: 'sshd -f %s -T'
notify: "Restart ssh"
when:
- create_sftp_group is defined and not create_sftp_group
- create_sftp_group is undefined or create_sftp_group is defined and not create_sftp_group
- ansible_facts['distribution'] == "Debian"
- ansible_facts['distribution_major_version'] <= "10"
tags:
@ -81,6 +111,7 @@
tags:
- sshd-config
- name: (sshd.yml) Check if sshd_config contains activ parameter 'Subsystem sftp'..
lineinfile:
path: /etc/ssh/sshd_config
@ -118,4 +149,3 @@
- ansible_facts['distribution_major_version'] > "10"
tags:
- sshd-config