Skip to content

Commit

Permalink
Prevent removing existing entries
Browse files Browse the repository at this point in the history
If a services key exists, and contains a compliant line in sssd.conf
which also contains other services, eg. `services = nss,pam`
we shouldn't remove the other services but we should keep them.
  • Loading branch information
jan-cerny committed Apr 12, 2024
1 parent 2dc0247 commit 4592d2e
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,23 @@
register: modify_lines_sssd_conf_file
when: sssd_conf_file.stat.exists

- name: {{{ rule_title }}} - Find services key in /etc/sssd/sssd.conf
ansible.builtin.lineinfile:
path: "/etc/sssd/sssd.conf"
regexp: '^\s*services\s*=.*$'
state: absent
changed_when: false
check_mode: true
register: sssd_conf_file_services
when: sssd_conf_file.stat.exists

- name: {{{ rule_title }}} - Insert entry to /etc/sssd/sssd.conf
ini_file:
path: /etc/sssd/sssd.conf
section: sssd
option: services
value: pam
when: not modify_lines_sssd_conf_d_files.changed and not modify_lines_sssd_conf_file.changed
when:
- not modify_lines_sssd_conf_d_files.changed
- not modify_lines_sssd_conf_file.changed
- (sssd_conf_file_services.found is defined and sssd_conf_file_services.found == 0) or not sssd_conf_file.stat.exists

0 comments on commit 4592d2e

Please sign in to comment.