Skip to content
Snippets Groups Projects
Commit 0b9618fe authored by jurgenhaas's avatar jurgenhaas
Browse files

ansible-roles/spideroak#3 Implement spideroak validation

parent ea79b09f
No related branches found
No related tags found
No related merge requests found
......@@ -12,4 +12,7 @@
- name: Import spideroak
import_tasks: spideroak.yml
- name: Validate Backup
import_tasks: validate.yml
when: (not excluded_roles or "spideroak" not in excluded_roles) and spideroak_username is defined and spideroak_username != ""
......@@ -37,6 +37,14 @@
- name: Wait
shell: sleep 5
- name: Ensure Monitoring Directory
file:
path: /var/backups/spideroak-monitoring
state: directory
- name: Add Monitoring Directory to SpiderOak
shell: SpiderOakONE --include-dir=/var/backups/spideroak-monitoring
- name: Add Directories to SpiderOak
shell: SpiderOakONE --include-dir={{ item }}
with_items: '{{ spideroak_include|default([]) }}'
......
---
# file: roles/spideroak/tasks/validate.yml
- block:
- name: Generate Random String
set_fact: random_string="{{ lookup('password', '/tmp/passwordfile length=25 chars=ascii_letters,digits') }}"
- name: Store Random String in validation.txt
copy:
dest: /var/backups/spideroak-monitoring/validation.txt
mode: 0644
content: '{{ random_string }}'
tags:
- validation_create_random
- block:
- name: Stop SpiderOak
service:
name: spideroak
state: stopped
pattern: SpiderOakONE
- name: Wait
shell: sleep 5
- name: Create File Share
shell: SpiderOakONE --share-single-file=/var/backups/spideroak-monitoring/validation.txt
register: spideroak_validation_link
- name: Start SpiderOak
service:
name: spideroak
state: started
- name: Download Share
get_url:
url: '{{ spideroak_validation_link.stdout_lines[0] }}'
dest: /tmp/spideroak.validation
mode: 0644
- name: Compare Strings
raw: diff /var/backups/spideroak-monitoring/validation.txt /tmp/spideroak.validation
register: diff_cmd
failed_when: diff_cmd.rc > 0
tags:
- validation_verify
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment