This commit is contained in:
aynic.os
2021-07-14 20:38:30 +01:00
parent e1f9ef7de9
commit 3ffea66ba8
101 changed files with 3601 additions and 939 deletions
+10 -9
View File
@@ -7,8 +7,8 @@
path: /etc/ssh/ssh_known_hosts
name: "{{ item }}"
key: "{{ lookup('pipe', 'ssh-keyscan -t rsa -H ' + item) }}"
become: true
ignore_errors: true
become: true
- name: ssh - define sshd configuration
set_fact:
@@ -24,20 +24,21 @@
regex: ^#?PermitRootLogin
- name: ssh - stat sshd configuration file
changed_when: false
register: sshd_config_stat
with_items: "{{ sshd_config|default([]) }}"
stat:
path: "{{ item.dest }}"
with_items: "{{ sshd_config|default([]) }}"
changed_when: false
register: sshd_config_stat
- name: ssh - configure sshd
become: yes
when: item.1.stat.exists
with_together:
- "{{ sshd_config|default([]) }}"
- "{{ sshd_config_stat.results }}"
lineinfile:
backrefs: true
dest: "{{ item.0.dest }}"
line: "{{ item.0.line }}"
regex: "{{ item.0.regex }}"
with_together:
- "{{ sshd_config|default([]) }}"
- "{{ sshd_config_stat.results }}"
when: item.1.stat.exists
become: yes