Add autorestic.all file and move two services
This commit is contained in:
parent
aa9c76a622
commit
c28a195f49
4 changed files with 37 additions and 16 deletions
|
@ -8,7 +8,8 @@ class FilterModule(object):
|
||||||
def my_service_attributes(self, services, host, attribute="name"):
|
def my_service_attributes(self, services, host, attribute="name"):
|
||||||
result = []
|
result = []
|
||||||
for service in services:
|
for service in services:
|
||||||
if service["host"] != host:
|
# only compare the host if it is set
|
||||||
|
if host and service["host"] != host:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
attribute_value = service.get(attribute)
|
attribute_value = service.get(attribute)
|
||||||
|
|
|
@ -21,6 +21,14 @@
|
||||||
dest: "{{ (service_path, '.autorestic.yml') | path_join }}"
|
dest: "{{ (service_path, '.autorestic.yml') | path_join }}"
|
||||||
mode: "0644"
|
mode: "0644"
|
||||||
|
|
||||||
|
- name: Template autorestic.all.yml
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: yml.j2
|
||||||
|
dest: "{{ (service_path, '.autorestic.all.yml') | path_join }}"
|
||||||
|
mode: "0644"
|
||||||
|
vars:
|
||||||
|
yml: "{{ backup_yml_all }}"
|
||||||
|
|
||||||
- name: Import tasks specific to the hooks scripts
|
- name: Import tasks specific to the hooks scripts
|
||||||
ansible.builtin.import_tasks: hooks.yml
|
ansible.builtin.import_tasks: hooks.yml
|
||||||
- name: Import tasks specific to systemd
|
- name: Import tasks specific to systemd
|
||||||
|
|
|
@ -4,6 +4,7 @@ backup_svc:
|
||||||
name: backup
|
name: backup
|
||||||
|
|
||||||
backup_list: "{{ all_services | my_service_attributes(inventory_hostname, 'backup') }}"
|
backup_list: "{{ all_services | my_service_attributes(inventory_hostname, 'backup') }}"
|
||||||
|
backup_list_all: "{{ all_services | my_service_attributes('', 'backup') }}"
|
||||||
|
|
||||||
backup_msg_start: "Backup started"
|
backup_msg_start: "Backup started"
|
||||||
backup_msg_fail: "Backup failed"
|
backup_msg_fail: "Backup failed"
|
||||||
|
@ -28,6 +29,20 @@ backup_default_hooks:
|
||||||
- '{{ backup_hc_curl_base }} --data "{{ backup_msg_fail_location }}${AUTORESTIC_LOCATION}" {{ backup_hc_url }}/fail'
|
- '{{ backup_hc_curl_base }} --data "{{ backup_msg_fail_location }}${AUTORESTIC_LOCATION}" {{ backup_hc_url }}/fail'
|
||||||
- '{{ backup_gatus_curl_base }} "{{ backup_gatus_url }}?success=false&error={{ backup_msg_fail_location | urlencode }}${AUTORESTIC_LOCATION}'
|
- '{{ backup_gatus_curl_base }} "{{ backup_gatus_url }}?success=false&error={{ backup_msg_fail_location | urlencode }}${AUTORESTIC_LOCATION}'
|
||||||
|
|
||||||
|
backup_global:
|
||||||
|
all:
|
||||||
|
cache-dir: "{{ (service_path, 'cache') | path_join }}"
|
||||||
|
retry-lock: 5m
|
||||||
|
forget:
|
||||||
|
keep-last: 7
|
||||||
|
keep-daily: 14
|
||||||
|
keep-weekly: 16
|
||||||
|
keep-monthly: 12
|
||||||
|
keep-yearly: 2
|
||||||
|
host: "{{ ansible_facts.hostname }}"
|
||||||
|
backup:
|
||||||
|
host: "{{ ansible_facts.hostname }}"
|
||||||
|
|
||||||
backup_yml:
|
backup_yml:
|
||||||
version: 2
|
version: 2
|
||||||
|
|
||||||
|
@ -35,16 +50,13 @@ backup_yml:
|
||||||
|
|
||||||
locations: "{{ backup_list | map_backup_locations(vault_backup.backends, backup_default_hooks ) }}"
|
locations: "{{ backup_list | map_backup_locations(vault_backup.backends, backup_default_hooks ) }}"
|
||||||
|
|
||||||
global:
|
global: "{{ backup_global }}"
|
||||||
all:
|
|
||||||
cache-dir: "{{ (service_path, 'cache') | path_join }}"
|
backup_yml_all:
|
||||||
retry-lock: 5m
|
version: 2
|
||||||
forget:
|
|
||||||
keep-last: 7
|
backends: "{{ vault_backup.backends }}"
|
||||||
keep-daily: 14
|
|
||||||
keep-weekly: 16
|
locations: "{{ backup_list_all | map_backup_locations(vault_backup.backends, backup_default_hooks ) }}"
|
||||||
keep-monthly: 12
|
|
||||||
keep-yearly: 2
|
global: "{{ backup_global }}"
|
||||||
host: "{{ ansible_facts.hostname }}"
|
|
||||||
backup:
|
|
||||||
host: "{{ ansible_facts.hostname }}"
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ services = {
|
||||||
|
|
||||||
"homebox" = {
|
"homebox" = {
|
||||||
name = "homebox"
|
name = "homebox"
|
||||||
host = "node002"
|
host = "node003"
|
||||||
dns = [{
|
dns = [{
|
||||||
domain = "serguzim.me"
|
domain = "serguzim.me"
|
||||||
target = "inventory"
|
target = "inventory"
|
||||||
|
@ -285,7 +285,7 @@ services = {
|
||||||
|
|
||||||
"ntfy" = {
|
"ntfy" = {
|
||||||
name = "ntfy"
|
name = "ntfy"
|
||||||
host = "node002"
|
host = "node003"
|
||||||
dns = [{
|
dns = [{
|
||||||
domain = "serguzim.me"
|
domain = "serguzim.me"
|
||||||
target = "push"
|
target = "push"
|
||||||
|
|
Loading…
Reference in a new issue