76 lines
2 KiB
YAML
76 lines
2 KiB
YAML
---
|
|
# Tasks file for the lvm_self_backup role
|
|
|
|
# Infrastructure
|
|
# Ansible instructions to deploy the infrastructure
|
|
# Copyright (C) 2020 Saibotk
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, version 3 of the License.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
- name: Create backup mount directories
|
|
file:
|
|
path: "/backup_snapshots/{{ item.vg_name }}-{{ item.lv_name }}"
|
|
state: directory
|
|
mode: '0700'
|
|
owner: 'root'
|
|
group: 'root'
|
|
recurse: true
|
|
with_items:
|
|
- "{{ backup_vols }}"
|
|
become: true
|
|
|
|
- name: Create backup status directory
|
|
file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
mode: '0700'
|
|
owner: 'root'
|
|
group: 'root'
|
|
recurse: true
|
|
with_items:
|
|
- "{{ backup_status_directory }}"
|
|
become: true
|
|
|
|
- name: Install backup scripts.
|
|
template:
|
|
src: "{{ item.src }}"
|
|
dest: "{{ item.dest }}"
|
|
mode: '0700'
|
|
owner: 'root'
|
|
group: 'root'
|
|
with_items:
|
|
- src: "backup-lvm.sh"
|
|
dest: "/usr/local/bin/backup-lvm"
|
|
- src: "backup-lvm-ls.sh"
|
|
dest: "/usr/local/bin/backup-lvm-ls"
|
|
become: true
|
|
|
|
- name: Install backup service & timer.
|
|
template:
|
|
src: "{{ item }}"
|
|
dest: /etc/systemd/system/
|
|
mode: '0755'
|
|
owner: 'root'
|
|
group: 'root'
|
|
with_items:
|
|
- "backup-lvm.service"
|
|
- "backup-lvm.timer"
|
|
become: true
|
|
|
|
- name: Start & enable backup service timer.
|
|
systemd:
|
|
daemon_reload: true
|
|
name: backup-lvm.timer
|
|
enabled: '{{ backup_timer_enabled | bool }}'
|
|
state: '{{ backup_timer_state }}'
|
|
become: true
|