This repository has been archived by the owner on Feb 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df91f3f
commit 4910404
Showing
10 changed files
with
91 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
|
||
- name: configure sshd in /etc/ssh/sshd_config | ||
ansible.builtin.template: | ||
src: '{{ lookup("first_found", __ssh_sshd_config_templates) }}' | ||
dest: /etc/ssh/sshd_config | ||
owner: root | ||
group: root | ||
mode: 0644 | ||
validate: /usr/sbin/sshd -t -f %s | ||
become: yes | ||
register: __sshd_configuration | ||
|
||
- name: configure sshd in /etc/ssh/sshd_config.d/10-ansible.conf | ||
ansible.builtin.template: | ||
src: '{{ lookup("first_found", __ssh_sshd_config_d_templates) }}' | ||
dest: /etc/ssh/sshd_config.d/10-ansible.conf | ||
owner: root | ||
group: root | ||
mode: 0600 | ||
validate: /usr/sbin/sshd -t -f %s | ||
become: yes | ||
when: __ssh_has_conf_d | ||
register: __sshd_configuration_conf_d | ||
|
||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
|
||
- name: get current sshd configuration /etc/ssh/sshd_config | ||
ansible.builtin.slurp: | ||
src: /etc/ssh/sshd_config.pacnew | ||
register: __ssh_etc_ssh_sshd_config_raw | ||
|
||
- name: parse sshd configuration | ||
ansible.builtin.set_fact: | ||
__ssh_etc_ssh_sshd_config: >- | ||
{{ | ||
(__ssh_etc_ssh_sshd_config_raw.content | b64decode).splitlines() | ||
}} | ||
- name: show sshd configuration | ||
ansible.builtin.debug: | ||
var: __ssh_etc_ssh_sshd_config | ||
|
||
- name: assert sshd configuration contains the include | ||
ansible.builtin.assert: | ||
that: >- | ||
'Include /etc/ssh/sshd_config.d/*.conf' in __ssh_etc_ssh_sshd_config | ||
success_msg: >- | ||
`/etc/ssh/sshd_config` contains `Include /etc/ssh/sshd_config.d/*.conf`. | ||
fail_msg: >- | ||
`/etc/ssh/sshd_config` does not contain `Include | ||
/etc/ssh/sshd_config.d/*.conf`. | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# {{ ansible_managed }} | ||
|
||
{% if ssh_host_keys is defined %} | ||
{% for key in ssh_host_keys %} | ||
HostKey {{ key }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,6 @@ __ssh_packages: openssh | |
|
||
__ssh_genkeys: sshdgenkeys.service | ||
|
||
__ssh_has_conf_d: yes | ||
|
||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,6 @@ | |
|
||
__ssh_packages: openssh-server | ||
|
||
__ssh_has_conf_d: yes | ||
|
||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
|
||
__ssh_packages: openssh-server | ||
|
||
__ssh_has_conf_d: no | ||
|
||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,6 @@ __ssh_packages: openssh-server | |
|
||
__ssh_genkeys: sshd-keygen.target | ||
|
||
__ssh_has_conf_d: yes | ||
|
||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
|
||
__ssh_packages: openssh-server | ||
|
||
__ssh_genkeys: sshd-keygen.target | ||
|
||
__ssh_has_conf_d: no | ||
|
||
... |