ansible/roles/rsnapshot-push/tasks/main.yml
Ryan Lerch 47c68f478d ansiblelint fixes - fqcn[action-core] - template to ansible.builtin.template
Replaces references to template: with ansible.builtin.template

Signed-off-by: Ryan Lerch <rlerch@redhat.com>
2025-01-15 11:30:29 +10:00

77 lines
2.3 KiB
YAML

---
- name: Backup script
ansible.builtin.template:
src: client-backup-script.sh.j2
dest: "/usr/local/bin/{{ item.value.command }}"
owner: "{{ item.value.user }}"
group: "{{ item.value.user }}"
mode: "0700"
with_dict:
- "{{ rsnapshot_push.cases }}"
tags: rsnapshot_push
- name: Install rsnapshot package
ansible.builtin.package:
name: rsnapshot
state: present
delegate_to: "{{ rsnapshot_push.server_host }}"
tags: rsnapshot_push
- name: Server-side case-specific backup dir
ansible.builtin.file:
path: "{{ '/'.join([rsnapshot_push.backup_dir, item.key]) }}"
state: directory
owner: "{{ item.value.user }}"
group: "{{ item.value.user }}"
mode: "0700"
with_dict:
- "{{ rsnapshot_push.cases }}"
delegate_to: "{{ rsnapshot_push.server_host }}"
tags: rsnapshot_push
- name: Server-side custom rsnapshot daemon script
ansible.builtin.template:
src: server-daemon.sh.j2
dest: "{{ '/'.join([rsnapshot_push.backup_dir, item.key, 'sync-daemon']) }}"
owner: "{{ item.value.user }}"
group: "{{ item.value.user }}"
mode: "0700"
with_dict:
- "{{ rsnapshot_push.cases }}"
delegate_to: "{{ rsnapshot_push.server_host }}"
tags: rsnapshot_push
- name: Install authorized key entry
authorized_key:
user: "{{ item.value.user }}"
state: present
key: "{{ item.value.ssh_pub_key }}"
key_options: "command=\"{{ '/'.join([rsnapshot_push.backup_dir, item.key, 'sync-daemon']) }}\""
delegate_to: "{{ rsnapshot_push.server_host }}"
with_dict:
- "{{ rsnapshot_push.cases }}"
tags: rsnapshot_push
- name: Rsnapshot call wrapper
ansible.builtin.template:
src: server-rsnapshot.py.j2
dest: "{{ '/'.join([rsnapshot_push.backup_dir, item.key, 'rsnapshot']) }}"
owner: "{{ item.value.user }}"
group: "{{ item.value.user }}"
mode: "0700"
with_dict:
- "{{ rsnapshot_push.cases }}"
delegate_to: "{{ rsnapshot_push.server_host }}"
tags: rsnapshot_push
- name: Cronjob run twice a week to trigger the backup (and rotation)
cron:
name: "rsnapshot_push backup - {{ item.key }}"
minute: "1"
hour: "1"
weekday: "6"
user: "{{ item.value.user }}"
job: "ionice --class=idle /usr/local/bin/{{ item.value.command }} >/dev/null"
with_dict:
- "{{ rsnapshot_push.cases }}"
tags: rsnapshot_push