EOX GitLab Instance

Commit 7afef2ca authored by Karl Grube's avatar Karl Grube
Browse files

borg work

parent 57f61456
......@@ -22,6 +22,9 @@
marker: "#{mark} ANSIBLE MANAGED SERVICE BACKUP FOR {{service_name}}"
block: |
{% for backup_server in backup_servers %}
{% if backup_encryption != 'none' %}
export BORG_PASSCOMMAND="cat /root/.borg_password"
{% endif %}
borg create backup@{{backup_server}}:{{service_name}}::$(date -I) {{backup_path}}
{% endfor %}
when: backup_path is defined
......
---
- name: python3-pip
package:
name: python3-pip
- name: expect
pip:
name: pexpect
- name: random_password generation
set_fact:
borg_random_passwd: "{{ pwgen(128) }}"
- name: borg password file
copy:
path: '/root/.borg_password'
mode: '400'
owner: root
group: root
content: "{{ borg_random_passwd }}"
force: no
---
- include: local.yml
- import_tasks: local.yml
- include: remote.yml
- import_tasks: encrypted.yml
when: backup_encryption != 'none'
- include_tasks: remote.yml
with_items: "{{backup_servers}}"
loop_control:
loop_var: backup_server
- include: backup.yml
- import_tasks: backup.yml
......@@ -38,8 +38,19 @@
owner: backup
group: backup
delegate_to: "{{backup_server}}"
- name: initialize backup
- name: initialize backup without encryption
command: "borg init backup@{{backup_server}}:{{service_name}} -e {{backup_encryption}}"
when: backup_encryption == 'none'
- name: initialize backup with encryption
expect:
command: "borg init backup@{{backup_server}}:{{service_name}} -e {{backup_encryption}}"
responses:
passphrase:
- "{{ borg_passwd }}"
- "{{ borg_passwd }}"
- "n"
- ""
when: backup_encryption != 'none'
when: remote_backup_directory.stat.exists == False
- name: borg pruning
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment