mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2024-11-14 00:41:06 +01:00
82 lines
2.9 KiB
YAML
82 lines
2.9 KiB
YAML
- name: install required software
|
|
community.general.pacman:
|
|
name:
|
|
- lsof
|
|
- python-pandas
|
|
state: present
|
|
when: run_once_backup_docker_to_local is not defined
|
|
|
|
- name: pull backup-docker-to-local.git
|
|
git:
|
|
repo: "https://github.com/kevinveenbirkenbach/backup-docker-to-local.git"
|
|
dest: "{{backup_docker_to_local_folder}}"
|
|
update: yes
|
|
ignore_errors: true
|
|
when: run_once_backup_docker_to_local is not defined
|
|
|
|
- name: configure backup-docker-to-local-everything.cymais.service
|
|
template:
|
|
src: backup-docker-to-local-everything.service.j2
|
|
dest: /etc/systemd/system/backup-docker-to-local-everything.cymais.service
|
|
notify: reload backup-docker-to-local-everything.cymais.service
|
|
when: run_once_backup_docker_to_local is not defined
|
|
|
|
- name: configure backup-docker-to-local.cymais.service
|
|
template:
|
|
src: backup-docker-to-local.service.j2
|
|
dest: /etc/systemd/system/backup-docker-to-local.cymais.service
|
|
notify: reload backup-docker-to-local.cymais.service
|
|
when: run_once_backup_docker_to_local is not defined
|
|
|
|
- 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}}"
|
|
when: run_once_backup_docker_to_local is not defined
|
|
|
|
- name: "reset {{ backup_docker_to_local_folder }}databases.csv"
|
|
file:
|
|
path: "{{ backup_docker_to_local_folder }}databases.csv"
|
|
state: absent
|
|
when: mode_reset | bool and run_once_backup_docker_to_local is not defined
|
|
|
|
- name: seed database values
|
|
command:
|
|
cmd: "python database_entry_seeder.py databases.csv {{database_instance}} {{database_name}} {{database_username}} {{database_password}}"
|
|
chdir: "{{backup_docker_to_local_folder}}"
|
|
when: >
|
|
database_host is defined or
|
|
database_name is defined or
|
|
database_username is defined or
|
|
database_password is defined
|
|
|
|
- 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'
|
|
owner: root
|
|
group: root
|
|
when: >
|
|
(database_host is defined or
|
|
database_name is defined or
|
|
database_username is defined or
|
|
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
|
|
|
|
- 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
|