|
143 | 143 | when: enable_etc_hosts
|
144 | 144 |
|
145 | 145 | - name: Configure sssd
|
146 |
| - block: |
147 |
| - - name: Manage sssd.conf configuration |
148 |
| - copy: |
149 |
| - src: "/mnt/cluster/hostconfig/{{ ansible_hostname }}/sssd.conf" |
150 |
| - dest: "{{ sssd_conf_dest }}" |
151 |
| - owner: root |
152 |
| - group: root |
153 |
| - mode: "0600" |
154 |
| - |
155 |
| - - name: Restart sssd |
156 |
| - systemd: |
157 |
| - name: sssd |
158 |
| - state: restarted |
159 |
| - when: sssd_started | bool |
160 |
| - |
161 |
| - - name: Ensure sssd service state |
162 |
| - systemd: |
163 |
| - name: sssd |
164 |
| - state: "{{ 'started' if sssd_started | bool else 'stopped' }}" |
165 |
| - enabled: "{{ sssd_enabled | bool }}" |
166 |
| - |
167 |
| - - name: Get current authselect configuration |
168 |
| - command: authselect current --raw |
169 |
| - changed_when: false |
170 |
| - failed_when: |
171 |
| - - _authselect_current.rc != 0 |
172 |
| - - "'No existing configuration detected' not in _authselect_current.stdout" |
173 |
| - register: _authselect_current # stdout: sssd with-mkhomedir |
174 |
| - |
175 |
| - - name: Configure nsswitch and PAM for SSSD |
176 |
| - command: "authselect select sssd --force{% if sssd_enable_mkhomedir | bool %} with-mkhomedir{% endif %}" |
177 |
| - when: "'sssd' not in _authselect_current.stdout" |
178 |
| - |
179 |
| - - name: "Ensure oddjob is started" |
180 |
| - service: |
181 |
| - name: oddjobd |
182 |
| - state: 'started' |
183 |
| - enabled: true |
184 |
| - when: sssd_enable_mkhomedir | bool |
185 |
| - when: enable_sssd |
| 146 | + ansible.builtin.include_role: |
| 147 | + name: sssd |
| 148 | + tasks_from: configure.yml |
| 149 | + vars: |
| 150 | + sssd_conf_src: "/mnt/cluster/hostconfig/{{ ansible_hostname }}/sssd.conf" |
| 151 | + when: enable_sshd |
186 | 152 |
|
187 | 153 | - name: Configure sshd
|
188 |
| - block: |
189 |
| - - name: Grab facts to determine distribution |
190 |
| - setup: |
191 |
| - |
192 |
| - - name: Ensure drop in directory exists |
193 |
| - file: |
194 |
| - path: /etc/ssh/sshd_config.d/*.conf |
195 |
| - state: directory |
196 |
| - owner: root |
197 |
| - group: root |
198 |
| - mode: "0700" |
199 |
| - |
200 |
| - - name: Ensure drop in directory is included |
201 |
| - blockinfile: |
202 |
| - dest: /etc/ssh/sshd_config |
203 |
| - content: | |
204 |
| - # To modify the system-wide sshd configuration, create a *.conf file under |
205 |
| - # /etc/ssh/sshd_config.d/ which will be automatically included below |
206 |
| - Include /etc/ssh/sshd_config.d/*.conf |
207 |
| - state: present |
208 |
| - insertafter: "# default value." |
209 |
| - validate: sshd -t -f %s |
210 |
| - when: ansible_facts.distribution_major_version == '8' |
211 |
| - |
212 |
| - - name: Restart sshd |
213 |
| - systemd: |
214 |
| - name: sshd |
215 |
| - state: restarted |
216 |
| - |
217 |
| - - name: Manage sshd.conf configuration |
218 |
| - copy: |
219 |
| - src: "/mnt/cluster/hostconfig/{{ ansible_hostname }}/sshd.conf" |
220 |
| - dest: "{{ sshd_conf_dest }}" |
221 |
| - owner: root |
222 |
| - group: root |
223 |
| - mode: "0600" |
224 |
| - validate: sshd -t -f %s |
225 |
| - |
226 |
| - - name: Restart sshd |
227 |
| - systemd: |
228 |
| - name: sshd |
229 |
| - state: restarted |
| 154 | + ansible.builtin.include_role: |
| 155 | + name: sshd |
| 156 | + vars: |
| 157 | + sshd_conf_src: "/mnt/cluster/hostconfig/{{ ansible_hostname }}/sshd.conf" |
230 | 158 | when: enable_sshd
|
231 | 159 |
|
232 | 160 | - name: Configure tuned
|
|
0 commit comments