2024-01-06 13:13:30 +01:00
|
|
|
- name: install required software
|
2023-08-07 23:02:22 +02:00
|
|
|
community.general.pacman:
|
|
|
|
name:
|
|
|
|
- lsof
|
|
|
|
- python-pandas
|
|
|
|
state: present
|
2023-12-12 15:10:11 +01:00
|
|
|
when: run_once_backup_docker_to_local is not defined
|
2022-01-23 22:01:21 +01:00
|
|
|
|
2023-11-16 17:07:28 +01:00
|
|
|
- name: pull backup-docker-to-local.git
|
2020-12-24 14:27:31 +01:00
|
|
|
git:
|
2023-11-16 17:07:28 +01:00
|
|
|
repo: "https://github.com/kevinveenbirkenbach/backup-docker-to-local.git"
|
2023-11-17 12:35:39 +01:00
|
|
|
dest: "{{backup_docker_to_local_folder}}"
|
2020-12-24 14:27:31 +01:00
|
|
|
update: yes
|
2023-05-28 23:08:38 +02:00
|
|
|
ignore_errors: true
|
2023-12-12 15:10:11 +01:00
|
|
|
when: run_once_backup_docker_to_local is not defined
|
2023-05-28 23:08:38 +02:00
|
|
|
|
2024-01-10 11:18:38 +01:00
|
|
|
- name: configure backup-docker-to-local-everything.cymais.service
|
2023-12-27 22:12:19 +01:00
|
|
|
template:
|
|
|
|
src: backup-docker-to-local-everything.service.j2
|
2024-01-10 11:18:38 +01:00
|
|
|
dest: /etc/systemd/system/backup-docker-to-local-everything.cymais.service
|
|
|
|
notify: reload backup-docker-to-local-everything.cymais.service
|
2023-12-27 22:12:19 +01:00
|
|
|
when: run_once_backup_docker_to_local is not defined
|
|
|
|
|
2024-01-10 11:18:38 +01:00
|
|
|
- name: configure backup-docker-to-local.cymais.service
|
2023-04-15 17:06:10 +02:00
|
|
|
template:
|
2023-11-16 17:07:28 +01:00
|
|
|
src: backup-docker-to-local.service.j2
|
2024-01-10 11:18:38 +01:00
|
|
|
dest: /etc/systemd/system/backup-docker-to-local.cymais.service
|
|
|
|
notify: reload backup-docker-to-local.cymais.service
|
2023-12-12 15:10:11 +01:00
|
|
|
when: run_once_backup_docker_to_local is not defined
|
2020-12-24 14:27:31 +01:00
|
|
|
|
2024-01-04 13:27:07 +01:00
|
|
|
- name: set service_name to the name of the current role
|
|
|
|
set_fact:
|
|
|
|
service_name: "{{ role_name }}"
|
|
|
|
when: run_once_backup_docker_to_local is not defined
|
|
|
|
|
|
|
|
- name: "include role for systemd-timer for {{service_name}}"
|
|
|
|
include_role:
|
|
|
|
name: systemd-timer
|
|
|
|
vars:
|
|
|
|
on_calendar: "{{on_calendar_backup_docker_to_local}}"
|
2023-12-12 15:10:11 +01:00
|
|
|
when: run_once_backup_docker_to_local is not defined
|
2022-01-23 21:43:05 +01:00
|
|
|
|
2024-01-06 14:31:02 +01:00
|
|
|
- name: "reset {{ backup_docker_to_local_folder }}databases.csv"
|
|
|
|
file:
|
|
|
|
path: "{{ backup_docker_to_local_folder }}databases.csv"
|
|
|
|
state: absent
|
2024-01-08 19:38:36 +01:00
|
|
|
when: mode_reset | bool and run_once_backup_docker_to_local is not defined
|
2024-01-06 14:31:02 +01:00
|
|
|
|
2024-01-14 20:08:08 +01:00
|
|
|
- name: "include seed-database-to-backup.yml"
|
|
|
|
include_tasks: seed-database-to-backup.yml
|
2023-12-26 03:13:16 +01:00
|
|
|
|
|
|
|
- name: Set file permissions for databases.csv to be readable, writable, and executable by root only
|
|
|
|
ansible.builtin.file:
|
|
|
|
path: "{{ backup_docker_to_local_folder }}databases.csv"
|
|
|
|
mode: '0700'
|
2022-01-23 21:43:05 +01:00
|
|
|
owner: root
|
|
|
|
group: root
|
2023-12-26 12:41:51 +01:00
|
|
|
when: >
|
2024-01-13 16:19:11 +01:00
|
|
|
(database_instance is defined and
|
|
|
|
database_name is defined and
|
|
|
|
database_username is defined and
|
2023-12-26 12:41:51 +01:00
|
|
|
database_password is defined) and
|
|
|
|
run_once_backup_docker_to_local_file_permission is not defined
|
|
|
|
register: file_permission_result
|
|
|
|
|
|
|
|
- name: run the backup_docker_to_local_file_permission tasks once
|
|
|
|
set_fact:
|
|
|
|
run_once_backup_docker_to_local_file_permission: true
|
|
|
|
when: run_once_backup_docker_to_local_file_permission is not defined and file_permission_result is defined and file_permission_result.changed
|
2023-12-12 15:10:11 +01:00
|
|
|
|
|
|
|
- name: run the backup_docker_to_local tasks once
|
|
|
|
set_fact:
|
|
|
|
run_once_backup_docker_to_local: true
|
|
|
|
when: run_once_backup_docker_to_local is not defined
|