Add automirror support to Ansible
This commit is contained in:
@ -1,24 +0,0 @@
|
||||
---
|
||||
# PVC Autobackup configuration
|
||||
# {{ ansible_managed }}
|
||||
|
||||
autobackup:
|
||||
backup_root_path: {{ pvc_autobackup.backup_root_path }}
|
||||
backup_root_suffix: {{ pvc_autobackup.backup_root_suffix }}
|
||||
backup_tags:
|
||||
{% for tag in pvc_autobackup.backup_tags %}
|
||||
- {{ tag }}
|
||||
{% endfor %}
|
||||
backup_schedule:
|
||||
full_interval: {{ pvc_autobackup.schedule.full_interval }}
|
||||
full_retention: {{ pvc_autobackup.schedule.full_retention }}
|
||||
auto_mount:
|
||||
enabled: {{ pvc_autobackup.auto_mount.enabled }}
|
||||
mount_cmds:
|
||||
{% for cmd in pvc_autobackup.auto_mount.mount_cmds %}
|
||||
- "{{ cmd }}"
|
||||
{% endfor %}
|
||||
unmount_cmds:
|
||||
{% for cmd in pvc_autobackup.auto_mount.unmount_cmds %}
|
||||
- "{{ cmd }}"
|
||||
{% endfor %}
|
9
roles/pvc/templates/automirror/pvc-automirror.service.j2
Normal file
9
roles/pvc/templates/automirror/pvc-automirror.service.j2
Normal file
@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=[Cron] PVC VM automirror
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
IgnoreSIGPIPE=false
|
||||
KillMode=process
|
||||
ExecCondition=/usr/bin/pvc --quiet node is-primary
|
||||
ExecStart=/usr/bin/pvc --quiet vm automirror --cron {% if pvc_automirror.reporting.enabled and (pvc_automirror.reporting.report_on.error or pvc_automirror.reporting.report_on.success) %}--email-report {{ pvc_automirror.reporting.emails|join(',') }}{% endif %} {% if pvc_automirror.reporting.enabled and (pvc_automirror.reporting.report_on.error and not pvc_automirror.reporting.report_on.success) %}--email-errors-only{% endif %}
|
9
roles/pvc/templates/automirror/pvc-automirror.timer.j2
Normal file
9
roles/pvc/templates/automirror/pvc-automirror.timer.j2
Normal file
@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=[Timer] PVC VM automirror
|
||||
|
||||
[Timer]
|
||||
Unit=pvc-automirror.service
|
||||
OnCalendar={{ pvc_automirror.schedule.time }}
|
||||
|
||||
[Install]
|
||||
WantedBy=pvc.target
|
@ -174,7 +174,7 @@ autobackup:
|
||||
full_interval: {{ pvc_autobackup.schedule.full_interval }}
|
||||
full_retention: {{ pvc_autobackup.schedule.full_retention }}
|
||||
auto_mount:
|
||||
enabled: {{ pvc_autobackup.auto_mount.enabled }}
|
||||
enabled: {{ 'yes' if pvc_autobackup.auto_mount.enabled else 'no' }}
|
||||
mount_cmds:
|
||||
{% for cmd in pvc_autobackup.auto_mount.mount_cmds %}
|
||||
- "{{ cmd }}"
|
||||
@ -184,6 +184,26 @@ autobackup:
|
||||
- "{{ cmd }}"
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
automirror:
|
||||
{% if pvc_automirror is defined and pvc_automirror.enabled is defined and pvc_automirror.enabled %}
|
||||
destinations:
|
||||
{% for destination in pvc_automirror.destinations %}
|
||||
{{ destination }}:
|
||||
address: {{ pvc_automirror.destinations[destination].address }}
|
||||
port: {{ pvc_automirror.destinations[destination].port }}
|
||||
prefix: {{ pvc_automirror.destinations[destination].prefix }}
|
||||
key: {{ pvc_automirror.destinations[destination].key }}
|
||||
ssl: {{ 'yes' if pvc_automirror.destinations[destination].ssl else 'no' }}
|
||||
verify_ssl: {{ 'yes' if pvc_automirror.destinations[destination].verify_ssl else 'no' }}
|
||||
pool: {{ pvc_automirror.destinations[destination].pool }}
|
||||
{% endfor %}
|
||||
default_destination: {{ pvc_automirror.default_destination }}
|
||||
mirror_tags:
|
||||
{% for tag in pvc_automirror.tags %}
|
||||
- {{ tag }}
|
||||
{% endfor %}
|
||||
keep_snapshots: {{ pvc_automirror.schedule.retention }}
|
||||
{% endif %}
|
||||
|
||||
# VIM modeline, requires "set modeline" in your VIMRC
|
||||
# vim: expandtab shiftwidth=2 tabstop=2 filetype=yaml
|
||||
|
Reference in New Issue
Block a user