Skip to content

Commit 3fbdff4

Browse files
committed
add sssd configuration to compute init script
1 parent 112aa6e commit 3fbdff4

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

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

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
# TODO: "= role defaults" - could be moved to a vars_file: on play with similar precedence effects
1818
resolv_conf_nameservers: []
1919

20+
sssd_enable_mkhomedir: false
21+
sssd_conf_dest: /etc/sssd/sssd.conf
22+
sssd_started: true
23+
sssd_enabled: true
24+
2025
nfs_client_mnt_point: "/mnt"
2126
nfs_client_mnt_options:
2227
nfs_client_mnt_state: mounted
@@ -125,6 +130,38 @@
125130
mode: 0644
126131
when: enable_etc_hosts
127132

133+
- name: Configure sssd
134+
block:
135+
- name: Manage sssd.conf configuration
136+
copy:
137+
src: "/exports/cluster/hostconfig/{{ ansible_hostname }}/sssd.conf"
138+
dest: "{{ sssd_conf_dest }}"
139+
140+
- name: Restart sssd
141+
systemd:
142+
name: sssd
143+
state: restarted
144+
when: sssd_started | bool
145+
146+
- name: Ensure sssd service state
147+
systemd:
148+
name: sssd
149+
state: "{{ 'started' if sssd_started | bool else 'stopped' }}"
150+
enabled: "{{ sssd_enabled | bool }}"
151+
152+
- name: Get current authselect configuration
153+
command: authselect current --raw
154+
changed_when: false
155+
failed_when:
156+
- _authselect_current.rc != 0
157+
- "'No existing configuration detected' not in _authselect_current.stdout"
158+
register: _authselect_current # stdout: sssd with-mkhomedir
159+
160+
- name: Configure nsswitch and PAM for SSSD
161+
command: "authselect select sssd --force{% if sssd_enable_mkhomedir | bool %} with-mkhomedir{% endif %}"
162+
when: "'sssd' not in _authselect_current.stdout"
163+
when: enable_sssd
164+
128165
# NFS client mount
129166
- name: If nfs-clients is present
130167
include_tasks: tasks/nfs-clients.yml

ansible/roles/compute_init/tasks/export.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,26 @@
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: Inject host specific config template files
85+
template:
86+
src: "{{ item.src }}"
87+
dest: "/exports/cluster/hostconfig/{{ inventory_hostname }}/{{ item.dest }}"
88+
owner: root
89+
group: root
90+
mode: u=rw,go=
91+
loop:
92+
- src: "{{ sssd_conf_src }}"
93+
dest: sssd.conf
94+
- src: "{{ sshd_conf_src }}"
95+
dest: sshd.conf
96+
delegate_to: "{{ groups['control'] | first }}"

0 commit comments

Comments
 (0)