roles done
This commit is contained in:
parent
542c444684
commit
32e6e8a2a9
9
roles/backupscript/files/backup-script.service
Normal file
9
roles/backupscript/files/backup-script.service
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Backup application data
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/usr/bin/bash /opt/backupscript.sh
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=backup.target
|
5
roles/backupscript/files/backup.target
Normal file
5
roles/backupscript/files/backup.target
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Script based backup for VMs
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=default.target
|
10
roles/backupscript/files/backup.timer
Normal file
10
roles/backupscript/files/backup.timer
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Backup VMs
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnBootSec=10min
|
||||||
|
OnCalendar=Sun *-*-* 00:00:00
|
||||||
|
Unit=backup.target
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
47
roles/backupscript/tasks/backupscript.yaml
Normal file
47
roles/backupscript/tasks/backupscript.yaml
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
---
|
||||||
|
- name: Copy backupscript to target
|
||||||
|
copy:
|
||||||
|
src: "{{ backupscript_name }}"
|
||||||
|
dest: /opt/backupscript.sh
|
||||||
|
mode: 700
|
||||||
|
owner: service-user
|
||||||
|
|
||||||
|
- name: Copy backup-script.service to target
|
||||||
|
copy:
|
||||||
|
src: backup-script.service
|
||||||
|
dest: /usr/lib/systemd/system/backup-script.service
|
||||||
|
mode: 644
|
||||||
|
owner: service-user
|
||||||
|
|
||||||
|
- name: Copy backup.target to target
|
||||||
|
copy:
|
||||||
|
src: backup.target
|
||||||
|
dest: /usr/lib/systemd/system/backup.target
|
||||||
|
mode: 644
|
||||||
|
owner: service-user
|
||||||
|
|
||||||
|
- name: Copy backup.timer to target
|
||||||
|
copy:
|
||||||
|
src: backup.timer
|
||||||
|
dest: /usr/lib/systemd/system/backup.timer
|
||||||
|
mode: 644
|
||||||
|
owner: service-user
|
||||||
|
|
||||||
|
- name: Enable backup-script.service and reload systemd daemon
|
||||||
|
when: ansible_service_mgr == "systemd"
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
enabled: yes
|
||||||
|
daemon_reload: yes
|
||||||
|
name: backup-script.service
|
||||||
|
|
||||||
|
- name: Enable backup.target
|
||||||
|
when: ansible_service_mgr == "systemd"
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
enabled: yes
|
||||||
|
name: backup.target
|
||||||
|
|
||||||
|
- name: Enable backup.timer
|
||||||
|
when: ansible_service_mgr == "systemd"
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
enabled: yes
|
||||||
|
name: backup.timer
|
@ -19,3 +19,10 @@
|
|||||||
name: docker
|
name: docker
|
||||||
state: restarted
|
state: restarted
|
||||||
enabled: yes
|
enabled: yes
|
||||||
|
|
||||||
|
- name: Copy docker-compose.yml to target
|
||||||
|
copy:
|
||||||
|
src: "{{ dockercompose_yml_name }}"
|
||||||
|
dest: /home/service-user/docker-compose.yml
|
||||||
|
mode: 600
|
||||||
|
owner: service-user
|
||||||
|
8
roles/mountpoint/tasks/mountpoint.yaml
Normal file
8
roles/mountpoint/tasks/mountpoint.yaml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
- name: Mount up device by UUID
|
||||||
|
ansible.posix.mount:
|
||||||
|
path: "{{ mountpoint_path }}"
|
||||||
|
src: "UUID={{ mountpoint_uuid }}"
|
||||||
|
fstype: "{{ mountpoint_fstype }}"
|
||||||
|
opts: "{{ mountpoint_opts }}"
|
||||||
|
state: mounted
|
Loading…
Reference in New Issue
Block a user