|
10 | 10 | enable_resolv_conf: "{{ os_metadata.meta.resolv_conf | default(false) | bool }}"
|
11 | 11 | enable_etc_hosts: "{{ os_metadata.meta.etc_hosts | default(false) | bool }}"
|
12 | 12 | enable_sssd: "{{ os_metadata.meta.sssd | default(false) | bool }}"
|
| 13 | + enable_sshd: "{{ os_metadata.meta.sshd | default(false) | bool }}" |
13 | 14 | enable_tuned: "{{ os_metadata.meta.tuned | default(false) | bool }}"
|
14 | 15 | enable_nfs: "{{ os_metadata.meta.nfs | default(false) | bool }}"
|
15 | 16 | enable_manila: "{{ os_metadata.meta.manila | default(false) | bool }}"
|
|
24 | 25 | sssd_started: true
|
25 | 26 | sssd_enabled: true
|
26 | 27 |
|
| 28 | + sshd_password_authentication: false |
| 29 | + sshd_conf_dest: /etc/ssh/sshd_config.d/10-ansible.conf |
| 30 | + |
27 | 31 | tuned_profile_baremetal: hpc-compute
|
28 | 32 | tuned_profile_vm: virtual-guest
|
29 | 33 | tuned_profile: "{{ tuned_profile_baremetal if ansible_virtualization_role != 'guest' else tuned_profile_vm }}"
|
|
141 | 145 | - name: Configure sssd
|
142 | 146 | block:
|
143 | 147 | - name: Manage sssd.conf configuration
|
144 |
| - ansible.builtin.template: |
145 |
| - src: "/mnt/cluster/hostconfig/{{ ansible_hostname }}/sssd.conf.j2" |
| 148 | + copy: |
| 149 | + src: "/mnt/cluster/hostconfig/{{ ansible_hostname }}/sssd.conf" |
146 | 150 | dest: "{{ sssd_conf_dest }}"
|
147 | 151 | owner: root
|
148 | 152 | group: root
|
|
179 | 183 | enabled: "{{ sssd_enable_mkhomedir }}"
|
180 | 184 | when: enable_sssd
|
181 | 185 |
|
| 186 | + - name: Configure sshd |
| 187 | + block: |
| 188 | + - name: Grab facts to determine distribution |
| 189 | + setup: |
| 190 | + |
| 191 | + - name: Ensure drop in directory exists |
| 192 | + file: |
| 193 | + path: /etc/ssh/sshd_config.d/*.conf |
| 194 | + state: directory |
| 195 | + owner: root |
| 196 | + group: root |
| 197 | + mode: "0700" |
| 198 | + |
| 199 | + - name: Ensure drop in directory is included |
| 200 | + blockinfile: |
| 201 | + dest: /etc/ssh/sshd_config |
| 202 | + content: | |
| 203 | + # To modify the system-wide sshd configuration, create a *.conf file under |
| 204 | + # /etc/ssh/sshd_config.d/ which will be automatically included below |
| 205 | + Include /etc/ssh/sshd_config.d/*.conf |
| 206 | + state: present |
| 207 | + insertafter: "# default value." |
| 208 | + validate: sshd -t -f %s |
| 209 | + when: ansible_facts.distribution_major_version == '8' |
| 210 | + |
| 211 | + - name: Restart sshd |
| 212 | + systemd: |
| 213 | + name: sshd |
| 214 | + state: restarted |
| 215 | + |
| 216 | + - name: Manage sshd.conf configuration |
| 217 | + copy: |
| 218 | + src: "/mnt/cluster/hostconfig/{{ ansible_hostname }}/sshd.conf" |
| 219 | + dest: "{{ sshd_conf_dest }}" |
| 220 | + owner: root |
| 221 | + group: root |
| 222 | + mode: "0600" |
| 223 | + validate: sshd -t -f %s |
| 224 | + |
| 225 | + - name: Restart sshd |
| 226 | + systemd: |
| 227 | + name: sshd |
| 228 | + state: restarted |
| 229 | + when: enable_sshd |
| 230 | + |
182 | 231 | - name: Configure tuned
|
183 | 232 | include_tasks: tasks/tuned.yml
|
184 | 233 | when: enable_tuned
|
|
0 commit comments