deploy-evobackup-beta : fix various issues

* bad permissions
* hard-coded path for cron job
* Ansible syntax for booleans
This commit is contained in:
Jérémy Lecour 2023-07-06 10:26:01 +02:00 committed by Jérémy Lecour
parent c3f238b3c6
commit 68daa1ebf2
Signed by: jlecour
SSH key fingerprint: SHA256:h+5LgHRKwN9lS0SsdVR5yZPeFlJE4Mt+8UtL4CcP8dY

View file

@ -1,8 +1,12 @@
###
# ansible-playbook deploy-evobackup-beta.yml -K --diff -l HOSTNAME --check
#
--- ---
- hosts: all - name: Deploy a beta version of evobackup
gather_facts: yes hosts: all
become: yes gather_facts: true
become: true
vars: vars:
evobackup_script_path: /etc/cron.daily/zzz_evobackup_beta evobackup_script_path: /etc/cron.daily/zzz_evobackup_beta
@ -13,37 +17,40 @@
- name: LIBDIR is present - name: LIBDIR is present
file: file:
path: "{{ evobackup_libdir }}" path: "{{ evobackup_libdir }}"
owner: root
group: root
mode: "0755"
state: directory state: directory
- name: libraries are installed - name: libraries are installed
copy: copy:
src: "{{ item }}" src: "{{ item }}"
dest: "{{ evobackup_libdir }}/" dest: "{{ evobackup_libdir }}/"
remote_src: False remote_src: false
owner: root owner: root
group: root group: root
mode: "0640" mode: "0644"
force: yes force: true
loop: "{{ lookup('fileglob', 'lib/*.sh', wantlist=True) }}" loop: "{{ lookup('fileglob', 'lib/*.sh', wantlist=True) }}"
- name: script is present - name: script is present
copy: copy:
src: zzz_evobackup.sh src: zzz_evobackup
dest: "{{ evobackup_script_path }}" dest: "{{ evobackup_script_path }}"
remote_src: False remote_src: false
owner: root owner: root
group: root group: root
mode: "0750" mode: "0750"
force: no force: false
- name: Email is customized - name: Email is customized
replace: replace:
dest: /etc/cron.daily/zzz_evobackup dest: "{{ evobackup_script_path }}"
regexp: "^MAIL=.*" regexp: "^MAIL=.*"
replace: "MAIL={{ evobackup_mail }}" replace: "MAIL={{ evobackup_mail }}"
- name: LIBDIR is customized - name: LIBDIR is customized
replace: replace:
dest: /etc/cron.daily/zzz_evobackup dest: "{{ evobackup_script_path }}"
regexp: "^LIBDIR=.*" regexp: "^LIBDIR=.*"
replace: "LIBDIR=\"{{ evobackup_libdir }}\"" replace: "LIBDIR=\"{{ evobackup_libdir }}\""