roles done

This commit is contained in:
Torma Kristóf 2022-01-10 04:49:15 +01:00
parent 542c444684
commit 32e6e8a2a9
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047
6 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,9 @@
[Unit]
Description=Backup application data
[Service]
Type=simple
ExecStart=/usr/bin/bash /opt/backupscript.sh
[Install]
WantedBy=backup.target

View File

@ -0,0 +1,5 @@
[Unit]
Description=Script based backup for VMs
[Install]
WantedBy=default.target

View 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

View 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

View File

@ -19,3 +19,10 @@
name: docker
state: restarted
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

View 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