committinh old changes

This commit is contained in:
2024-02-06 10:35:56 +01:00
parent 9568139378
commit 4a829ed81a
10 changed files with 46 additions and 53 deletions

View File

@@ -23,7 +23,7 @@
- name: configure client
template:
src: ldap.conf
dest: "{{ ldap_config_dir }}/ldap.conf"
dest: /etc/openldap/ldap.conf
mode: 0644
- name: activate service
@@ -36,16 +36,47 @@
block:
- name: remove existing acl
ldap_attr:
dn: "{{ ldap_database }},cn=config"
dn: olcDatabase={2}hdb,cn=config
name: olcaccess
values: []
state: exact
- name: admin, suffix and cache
ldap_attr:
dn: olcDatabase={2}hdb,cn=config
name: "{{ item.key }}"
values: "{{ item.value }}"
state: exact
with_dict:
olcSuffix: "{{ ldap_suffix }}"
olcRootDN: "{{ ldap_admin_dn }}"
olcRootPW: "{{ ldap_admin_password }}"
olcDbCheckpoint: "{{ ldap_checkpoint }}"
olcDbCacheSize: "{{ ldap_cache_size }}"
olcDbIDLCacheSize: "{{ ldap_idlcache_size }}"
olcAccess:
- >-
{0}to attrs=userPassword,mail
by self write
by anonymous auth
by * none
- >-
{1}to dn.sub={{ ldap_suffix }}
by users read
by * none
ignore_errors: true
- name: remove existing indexes
ldap_attr:
dn: olcDatabase={2}hdb,cn=config
values: []
name: olcDbIndex
state: exact
- name: add indexes
ldap_attr:
dn: "{{ ldap_database }},cn=config"
dn: olcDatabase={2}hdb,cn=config
name: "olcDbIndex"
state: exact
values: "{{ item }}"
loop:
- objectClass pres,eq
@@ -64,7 +95,6 @@
loop:
- olcDatabase={0}config,cn=config
- olcDatabase={1}monitor,cn=config
ignore_errors: true
- name: load additionnal schema
include_tasks: import_ldap_schema.yml
@@ -170,34 +200,3 @@
loop: "{{ ldap_entries }}"
when: ldap_entries is defined
ignore_errors: true
- name: create root bin and backup dirs
tags: backup
file:
path: "{{ item }}"
state: directory
owner: root
group: root
mode: 0700
loop:
- "{{ ldap_backup_dir }}"
- /root/bin
- name: deploy backup script
tags: backup
copy:
src: /home/tom/Documents/Opendoor/Developpement/Scripts/ldap_backup.sh
dest: /root/bin
mode: 0700
- name: backup script cron
tags: backup
cron:
name: ldap_backup
cron_file: ldap_backup
user: root
hour: "02"
minute: "{{ 59 | random ( seed=inventory_hostname ) }}"
job: "/root/bin/ldap_backup.sh {{ ldap_backup_dir }}"