backup stuff
This commit is contained in:
parent
01b83a80ec
commit
27e036eccd
16 changed files with 513 additions and 0 deletions
53
ansible/roles/backup_store/tasks/main.yml
Normal file
53
ansible/roles/backup_store/tasks/main.yml
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
- name: Assert backup_store sources are sane
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- backup_store_sources | length > 0
|
||||
- backup_store_sources | map(attribute='name') | list | length == backup_store_sources | length
|
||||
- backup_store_sources | map(attribute='source') | list | length == backup_store_sources | length
|
||||
- backup_store_sources | map(attribute='retention_days') | list | length == backup_store_sources | length
|
||||
fail_msg: "backup_store: every source needs name, source and retention_days"
|
||||
quiet: true
|
||||
|
||||
- name: Ensure rsync is installed
|
||||
ansible.builtin.apt:
|
||||
name: rsync
|
||||
state: present
|
||||
update_cache: yes
|
||||
cache_valid_time: 3600
|
||||
become: yes
|
||||
|
||||
- name: Ensure the backup store directory exists
|
||||
ansible.builtin.file:
|
||||
path: "{{ backup_store_dir }}"
|
||||
state: directory
|
||||
mode: '0700'
|
||||
|
||||
- name: Install the pull-backups script
|
||||
ansible.builtin.template:
|
||||
src: pull-backups.sh.j2
|
||||
dest: /usr/local/bin/pull-backups.sh
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0755'
|
||||
validate: "bash -n %s"
|
||||
become: yes
|
||||
|
||||
- name: Install the pull-backups systemd units
|
||||
ansible.builtin.template:
|
||||
src: "pull-backups.{{ item }}.j2"
|
||||
dest: "/etc/systemd/system/pull-backups.{{ item }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: '0644'
|
||||
loop: [service, timer]
|
||||
become: yes
|
||||
notify: Reload systemd for pull-backups
|
||||
|
||||
- name: Enable the pull-backups timer
|
||||
ansible.builtin.systemd:
|
||||
name: pull-backups.timer
|
||||
enabled: yes
|
||||
state: started
|
||||
daemon_reload: yes
|
||||
become: yes
|
||||
Loading…
Add table
Add a link
Reference in a new issue