Skip to content

Commit 8b1c94c

Browse files
authored
Support sssd and sshd in compute-init (#571)
* add sssd configuration to compute init script * fix export.yml for inactive configs * add sssd oddjobd service to compute-init script * refactor config export task, enable sshd * document * fix oddjobd condition * fix task guarding, improve compute-init script * remove redundant compute-init playbook vars
1 parent f276fb6 commit 8b1c94c

File tree

7 files changed

+66
-4
lines changed

7 files changed

+66
-4
lines changed

ansible/roles/compute_init/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ it also requires an image build with the role name added to the
4646
| bootstrap.yml | (system users) | None required - use image build | No |
4747
| bootstrap.yml | systemd | None required - use image build | No |
4848
| bootstrap.yml | selinux | None required - use image build | Maybe [1] |
49-
| bootstrap.yml | sshd | None at present | No |
49+
| bootstrap.yml | sshd | Fully supported | No |
5050
| bootstrap.yml | dnf_repos | None at present [2] | - |
5151
| bootstrap.yml | squid | Not relevant for compute nodes | n/a |
5252
| bootstrap.yml | tuned | Fully supported | No |
@@ -63,7 +63,7 @@ it also requires an image build with the role name added to the
6363
| hooks/post-bootstrap.yml | ? | None at present | n/a |
6464
| iam.yml | freeipa_client | None at present [3] | Yes |
6565
| iam.yml | freeipa_server | Not relevant for compute nodes | n/a |
66-
| iam.yml | sssd | None at present | No |
66+
| iam.yml | sssd | Fully supported | No |
6767
| filesystems.yml | block_devices | None required - role deprecated | n/a |
6868
| filesystems.yml | nfs | All client functionality | No |
6969
| filesystems.yml | manila | All functionality | No [4] |

ansible/roles/compute_init/files/compute-init.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
enable_compute: "{{ os_metadata.meta.compute | default(false) | bool }}"
1010
enable_resolv_conf: "{{ os_metadata.meta.resolv_conf | default(false) | bool }}"
1111
enable_etc_hosts: "{{ os_metadata.meta.etc_hosts | default(false) | bool }}"
12+
enable_sssd: "{{ os_metadata.meta.sssd | default(false) | bool }}"
13+
enable_sshd: "{{ os_metadata.meta.sshd | default(false) | bool }}"
1214
enable_tuned: "{{ os_metadata.meta.tuned | default(false) | bool }}"
1315
enable_nfs: "{{ os_metadata.meta.nfs | default(false) | bool }}"
1416
enable_manila: "{{ os_metadata.meta.manila | default(false) | bool }}"
@@ -132,6 +134,21 @@
132134
mode: 0644
133135
when: enable_etc_hosts
134136

137+
- name: Configure sssd
138+
ansible.builtin.include_role:
139+
name: sssd
140+
tasks_from: configure.yml
141+
vars:
142+
sssd_conf_src: "/mnt/cluster/hostconfig/{{ ansible_hostname }}/sssd.conf"
143+
when: enable_sssd
144+
145+
- name: Configure sshd
146+
ansible.builtin.include_role:
147+
name: sshd
148+
vars:
149+
sshd_conf_src: "/mnt/cluster/hostconfig/{{ ansible_hostname }}/sshd.conf"
150+
when: enable_sshd
151+
135152
- name: Configure tuned
136153
include_tasks: tasks/tuned.yml
137154
when: enable_tuned

ansible/roles/compute_init/tasks/export.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,24 @@
7171
remote_src: true
7272
run_once: true
7373
delegate_to: "{{ groups['control'] | first }}"
74+
75+
- name: Create hostconfig directory
76+
file:
77+
path: "/exports/cluster/hostconfig/{{ inventory_hostname }}/"
78+
state: directory
79+
owner: root
80+
group: root
81+
mode: u=rw,go=
82+
delegate_to: "{{ groups['control'] | first }}"
83+
84+
- name: Template sssd config
85+
import_role:
86+
name: sssd
87+
tasks_from: export.yml
88+
when: "'sssd' in group_names"
89+
90+
- name: Template sshd config
91+
import_role:
92+
name: sshd
93+
tasks_from: export.yml
94+
when: "'sshd' in group_names"

ansible/roles/compute_init/tasks/install.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- library
1414
- filter_plugins
1515
- tasks
16+
- roles
1617

1718
- name: Inject files from roles
1819
copy:
@@ -32,6 +33,10 @@
3233
dest: files/NetworkManager-dns-none.conf
3334
- src: ../../basic_users/filter_plugins/filter_keys.py
3435
dest: filter_plugins/filter_keys.py
36+
- src: ../../sssd
37+
dest: roles/
38+
- src: ../../sshd
39+
dest: roles/
3540
- src: ../../tuned/tasks/configure.yml
3641
dest: tasks/tuned.yml
3742
- src: ../../stackhpc.nfs/tasks/nfs-clients.yml

ansible/roles/sshd/tasks/export.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Exclusively used for compute-init
2+
- name: Inject host specific config template
3+
template:
4+
src: "{{ sshd_conf_src }}"
5+
dest: "/exports/cluster/hostconfig/{{ inventory_hostname }}/sshd.conf"
6+
owner: root
7+
group: root
8+
mode: u=rw,go=
9+
delegate_to: "{{ groups['control'] | first }}"

ansible/roles/sssd/tasks/configure.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,6 @@
3030
- name: "Ensure oddjob is started"
3131
service:
3232
name: oddjobd
33-
state: "{{ sssd_enable_mkhomedir }}"
34-
enabled: "{{ sssd_enable_mkhomedir }}"
33+
state: 'started'
34+
enabled: true
35+
when: sssd_enable_mkhomedir | bool

ansible/roles/sssd/tasks/export.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Exclusively used for compute-init
2+
- name: Inject host specific config template
3+
template:
4+
src: "{{ sssd_conf_src }}"
5+
dest: "/exports/cluster/hostconfig/{{ inventory_hostname }}/sssd.conf"
6+
owner: root
7+
group: root
8+
mode: u=rw,go=
9+
delegate_to: "{{ groups['control'] | first }}"

0 commit comments

Comments
 (0)