Port backup zfs datasets
This commit is contained in:
parent
d0708f520d
commit
9eb3905adf
@ -73,15 +73,8 @@ services_host_services:
|
|||||||
# --------------------------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------------------------
|
||||||
# services:backups
|
# services:backups
|
||||||
# --------------------------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------------------------
|
||||||
services_backups_syncoid_data_dataset: "{{ services_data_dataset |
|
services_backups_backup_dataset: "hpool/backup"
|
||||||
|
services_backups_backup_root_dataset: "{{ services_root_dataset |
|
||||||
|
replace('rpool/var/lib', 'hpool/backup') }}"
|
||||||
|
services_backups_backup_data_dataset: "{{ services_data_dataset |
|
||||||
replace('rpool/var/lib', 'hpool/backup') }}"
|
replace('rpool/var/lib', 'hpool/backup') }}"
|
||||||
services_backups_datasets: "\
|
|
||||||
{% set datasets = {} %}\
|
|
||||||
{% for service in services_host_services.keys() %}\
|
|
||||||
{{ datasets.update({ ( 'pod-' ~ service ): None }) }}\
|
|
||||||
{% endfor %}\
|
|
||||||
{{ datasets }}"
|
|
||||||
services_backups_snapshots_syncoid:
|
|
||||||
datasets_root: "hpool/backup/yggdrasil/data"
|
|
||||||
default_recursive: true
|
|
||||||
default_skip_parent: true
|
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
- name: "Setup hosts for services"
|
|
||||||
hosts: asgard
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
- import_tasks: tasks/services/a-common/01-zfs-datasets.yml
|
|
||||||
when: is_zfs
|
|
@ -1,9 +0,0 @@
|
|||||||
---
|
|
||||||
- name: "Deploy services"
|
|
||||||
hosts: asgard
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
- include_tasks: tasks/services/b-user/service-user.yml
|
|
||||||
with_items: "{{ host_services }}"
|
|
||||||
loop_control:
|
|
||||||
loop_var: service_name
|
|
@ -1,19 +0,0 @@
|
|||||||
- name: Create backup dataset
|
|
||||||
zfs:
|
|
||||||
name: hpool/backup
|
|
||||||
state: present
|
|
||||||
extra_zfs_properties:
|
|
||||||
canmount: "off"
|
|
||||||
"com.sun:auto-snapshot": "false"
|
|
||||||
|
|
||||||
- name: Create service backup dataset
|
|
||||||
zfs:
|
|
||||||
name: hpool/backup/{{ ansible_hostname }}
|
|
||||||
state: present
|
|
||||||
|
|
||||||
- name: Create service data backup dataset
|
|
||||||
zfs:
|
|
||||||
name: hpool/backup/{{ ansible_hostname }}/data
|
|
||||||
state: present
|
|
||||||
extra_zfs_properties:
|
|
||||||
canmount: "off"
|
|
@ -1,4 +0,0 @@
|
|||||||
- block:
|
|
||||||
- import_tasks: service-user/01-zfs-datasets.yml
|
|
||||||
when: is_zfs
|
|
||||||
tags: "{{ service_name }}"
|
|
@ -1,6 +0,0 @@
|
|||||||
- name: Create service data backup dataset for user {{ service_user_name }}
|
|
||||||
zfs:
|
|
||||||
name: hpool/backup/{{ ansible_hostname }}/data/{{ service_user_name }}
|
|
||||||
state: present
|
|
||||||
extra_zfs_properties:
|
|
||||||
canmount: "off"
|
|
@ -3,8 +3,8 @@
|
|||||||
hosts: "yggdrasil"
|
hosts: "yggdrasil"
|
||||||
roles:
|
roles:
|
||||||
- role: "snapshots"
|
- role: "snapshots"
|
||||||
tags: "backups:snapshots"
|
|
||||||
when: the_nine_worlds_production | bool
|
when: the_nine_worlds_production | bool
|
||||||
|
tags: "backups:snapshots"
|
||||||
# - role: "backups"
|
# - role: "backups"
|
||||||
# tags: "backups:restic"
|
|
||||||
# when: the_nine_worlds_production | bool
|
# when: the_nine_worlds_production | bool
|
||||||
|
# tags: "backups:restic"
|
||||||
|
@ -60,7 +60,27 @@
|
|||||||
- name: "services : yggdrasil"
|
- name: "services : yggdrasil"
|
||||||
hosts: "yggdrasil"
|
hosts: "yggdrasil"
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- role: "datasets/backups/system"
|
||||||
|
when: the_nine_worlds_production | bool
|
||||||
|
tags: "services:datasets_backups_system"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
- name: "datasets_backups_user"
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: "datasets/backups/user"
|
||||||
|
apply:
|
||||||
|
tags:
|
||||||
|
- "services:{{ services_service_name }}"
|
||||||
|
- "services:datasets_backups_user"
|
||||||
|
- "services:datasets_backups_user:{{ services_service_name }}"
|
||||||
|
- "services:{{ services_service_name }}:datasets_backups_user"
|
||||||
|
loop: "{{ services_host_services | dict2items | map(attribute='key') }}"
|
||||||
|
loop_control:
|
||||||
|
loop_var: "services_service_name"
|
||||||
|
when: the_nine_worlds_production | bool
|
||||||
|
tags: "always"
|
||||||
|
|
||||||
- name: "backups"
|
- name: "backups"
|
||||||
ansible.builtin.include_role:
|
ansible.builtin.include_role:
|
||||||
name: "backups"
|
name: "backups"
|
||||||
@ -73,5 +93,5 @@
|
|||||||
loop: "{{ services_host_services | dict2items | map(attribute='key') }}"
|
loop: "{{ services_host_services | dict2items | map(attribute='key') }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: "services_service_name"
|
loop_var: "services_service_name"
|
||||||
tags: "always"
|
|
||||||
when: the_nine_worlds_production | bool
|
when: the_nine_worlds_production | bool
|
||||||
|
tags: "always"
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
services_backups_user_dataset: "{{ services_data_dataset }}/{{ services_service_user_name }}"
|
services_backups_user_dataset: "{{ services_data_dataset }}/{{ services_service_user_name }}"
|
||||||
services_backups_user_syncoid_dataset: "\
|
services_backups_user_syncoid_dataset: "\
|
||||||
{{ services_backups_syncoid_data_dataset }}/{{ services_service_user_name }}"
|
{{ services_backups_backup_data_dataset }}/{{ services_service_user_name }}"
|
||||||
|
19
plays/services/roles/datasets/backups/system/tasks/main.yml
Normal file
19
plays/services/roles/datasets/backups/system/tasks/main.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
- name: "create root backup dataset"
|
||||||
|
community.general.zfs:
|
||||||
|
name: "{{ services_backups_backup_dataset }}"
|
||||||
|
state: "present"
|
||||||
|
extra_zfs_properties:
|
||||||
|
canmount: "off"
|
||||||
|
"com.sun:auto-snapshot": "false"
|
||||||
|
|
||||||
|
- name: "create services backup dataset"
|
||||||
|
community.general.zfs:
|
||||||
|
name: "{{ services_backups_backup_root_dataset }}"
|
||||||
|
state: "present"
|
||||||
|
|
||||||
|
- name: "create services data backup dataset"
|
||||||
|
community.general.zfs:
|
||||||
|
name: "{{ services_backups_backup_data_dataset }}"
|
||||||
|
state: "present"
|
||||||
|
extra_zfs_properties:
|
||||||
|
canmount: "off"
|
11
plays/services/roles/datasets/backups/user/tasks/main.yml
Normal file
11
plays/services/roles/datasets/backups/user/tasks/main.yml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
- name: "{{ services_service_name }} : set variables"
|
||||||
|
ansible.builtin.import_role:
|
||||||
|
name: "include"
|
||||||
|
vars_from: "user"
|
||||||
|
|
||||||
|
- name: "{{ services_service_name }} : create service backup data dataset"
|
||||||
|
community.general.zfs:
|
||||||
|
name: "{{ services_backups_backup_data_dataset }}/{{ services_service_user_name }}"
|
||||||
|
state: "present"
|
||||||
|
extra_zfs_properties:
|
||||||
|
canmount: "off"
|
@ -23,9 +23,9 @@
|
|||||||
hosts: "all"
|
hosts: "all"
|
||||||
roles:
|
roles:
|
||||||
- role: "mail"
|
- role: "mail"
|
||||||
tags: "system:mail"
|
|
||||||
when: the_nine_worlds_production | bool
|
when: the_nine_worlds_production | bool
|
||||||
|
tags: "system:mail"
|
||||||
- role: "base"
|
- role: "base"
|
||||||
tags: "system:base"
|
|
||||||
vars:
|
vars:
|
||||||
system_base_motd_dir: "files/base/motd"
|
system_base_motd_dir: "files/base/motd"
|
||||||
|
tags: "system:base"
|
||||||
|
Loading…
Reference in New Issue
Block a user