setup backup script

This commit is contained in:
2021-03-20 23:20:22 +01:00
parent 1f9af114de
commit 9568139378
3 changed files with 33 additions and 0 deletions

View File

@@ -39,6 +39,7 @@ defined in vars/main.yml and vars/CentOS.yml
* ldap_service - name of service unit file - slapd
* ldap_user - slapd service account
* ldap_schemas - list of additionnal schema names to load - default cosine
* ldap_backup_dir - default /srv/backups/ldap
* ldap_replication_consumer - bool -true to setup a replication consumer
* ldap_replication_provider - bool -true to setup a replication provider
* ldap_replication_account - account used for replication

View File

@@ -18,6 +18,7 @@ ldap_ssl_key_path: "{{ ldap_ssl_dir }}/key.pem"
ldap_ssl_cacert_path: "{{ ldap_ssl_dir }}/cert.pem"
ldap_admin_dn: "cn=manager,{{ldap_suffix}}"
ldap_admin_password: "CHANGEME"
ldap_backup_dir: /srv/backups/ldap
ldap_auth:
bind_dn: "{{ ldap_admin_dn }}"
bind_pw: "{{ ldap_admin_password }}"

View File

@@ -170,3 +170,34 @@
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 }}"