deploiement script de backup
This commit is contained in:
@@ -55,6 +55,7 @@ defined in vars/main.yml and vars/CentOS.yml
|
||||
* ldap_ssl_key_path - {{ ldap_ssl_dir }}/{{ ansible_fqdn }}_privkey.pem
|
||||
* ldap_ldif_files - optional list of ldif files to send to server and inject.
|
||||
Will be templated. need absolute path
|
||||
* ldap_backup_dir: /srv/backups/ldap/
|
||||
|
||||
|
||||
Dependencies
|
||||
|
||||
@@ -68,3 +68,4 @@ ldap_entries:
|
||||
attributes:
|
||||
olcOverlay: "{2}unique"
|
||||
olcUniqueURI: ldap:///?uid?sub?
|
||||
ldap_backup_dir: /srv/backups/ldap/
|
||||
|
||||
31
tasks/backup.yml
Normal file
31
tasks/backup.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
- name: create root bin and backup dirs
|
||||
ansible.builtin.file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0700
|
||||
loop:
|
||||
- "{{ ldap_backup_dir }}"
|
||||
- /root/bin
|
||||
|
||||
|
||||
- name: deploy backup script
|
||||
ansible.builtin.git:
|
||||
repo: https://infra.opendoor.fr/git/tom/Ldap_backup.git
|
||||
dest: /root/bin/ldap_backup
|
||||
|
||||
- name: backup script permissions
|
||||
ansible.builtin.file:
|
||||
path: /root/bin/ldap_backup/ldap_backup.sh
|
||||
mode: 700
|
||||
|
||||
- name: backup script cron
|
||||
ansible.builtin.cron:
|
||||
name: ldap_backup
|
||||
cron_file: ldap_backup
|
||||
user: root
|
||||
hour: "01"
|
||||
minute: "00"
|
||||
job: "/root/bin/ldap_backup/ldap_backup.sh {{ ldap_backup_dir }}"
|
||||
@@ -203,3 +203,7 @@
|
||||
loop: "{{ ldap_entries }}"
|
||||
when: ldap_entries is defined
|
||||
ignore_errors: true
|
||||
|
||||
- name: setup backup
|
||||
import_tasks: backup.yml
|
||||
tags: backup_ldap
|
||||
|
||||
Reference in New Issue
Block a user