2022-01-23 00:38:23 +01:00
|
|
|
- name: system | ldap auth
|
|
|
|
block:
|
|
|
|
- name: Load OS specific variables.
|
|
|
|
tags: ldap
|
|
|
|
ansible.builtin.include_vars:
|
2022-01-23 01:05:44 +01:00
|
|
|
file: "os_{{ ansible_facts['lsb']['id'] }}.yml"
|
2022-01-23 00:38:23 +01:00
|
|
|
|
|
|
|
- name: Install packages.
|
|
|
|
tags: ldap,packages,ldap-auth
|
|
|
|
ansible.builtin.package:
|
|
|
|
state: present
|
|
|
|
name:
|
|
|
|
- "{{ package_libnss_ldapd }}"
|
|
|
|
- libsss-sudo
|
|
|
|
- sssd
|
|
|
|
|
|
|
|
- name: Create config directories.
|
|
|
|
tags: ldap,ldap-auth
|
|
|
|
ansible.builtin.file:
|
|
|
|
state: directory
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0755
|
|
|
|
path: "{{ item }}"
|
|
|
|
with_items:
|
|
|
|
- /etc/sssd
|
|
|
|
- /etc/ldap
|
|
|
|
|
|
|
|
- name: Copy config files.
|
|
|
|
tags: ldap,ldap-auth
|
|
|
|
ansible.builtin.copy:
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0644
|
|
|
|
src: "{{ item.src }}"
|
|
|
|
dest: "{{ item.dest }}"
|
|
|
|
with_items:
|
|
|
|
- src: nscd.conf
|
|
|
|
dest: /etc/nscd.conf
|
|
|
|
- src: nsswitch.conf
|
|
|
|
dest: /etc/nsswitch.conf
|
|
|
|
- src: "ldap/{{ ldap_cert }}"
|
|
|
|
dest: "/etc/ldap/{{ ldap_cert }}"
|
|
|
|
notify:
|
|
|
|
- restart_nscd
|
|
|
|
|
|
|
|
- name: Create config files from templates.
|
|
|
|
tags: ldap
|
|
|
|
template:
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: 0600
|
|
|
|
src: "{{ item.src }}"
|
|
|
|
dest: "{{ item.dest }}"
|
|
|
|
with_items:
|
|
|
|
- src: sssd/sssd.conf
|
|
|
|
dest: /etc/sssd/sssd.conf
|
|
|
|
- src: nslcd.conf
|
|
|
|
dest: /etc/nslcd.conf
|
|
|
|
- src: ldap/ldap.conf
|
|
|
|
dest: /etc/ldap/ldap.conf
|
|
|
|
notify:
|
|
|
|
- restart_nslcd
|
|
|
|
- restart_sssd
|
|
|
|
|
2022-01-23 01:02:15 +01:00
|
|
|
- name: Copy certificate file.
|
|
|
|
ansible.builtin.copy:
|
|
|
|
src: "{{ ldap_cert }}"
|
|
|
|
|
2022-01-23 00:38:23 +01:00
|
|
|
- name: Enable services.
|
|
|
|
ansible.builtin.service:
|
|
|
|
name: "{{ item }}"
|
|
|
|
enabled: yes
|
|
|
|
with_items:
|
|
|
|
- nslcd
|
|
|
|
- nscd
|
|
|
|
- sssd
|
|
|
|
|
|
|
|
when:
|
|
|
|
- ldap_uris | length > 0
|