aboutsummaryrefslogtreecommitdiffstats
path: root/molecule/default/converge.yml
blob: 9c23b5f111a63d9295d52df78611c1b0f4636081 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---
- name: Converge
  hosts: borg-client

  pre_tasks:
      # This would usually be set by the user globally on their ansible
      # repository and can be a security risk to do automatically. We will
      # however set the variable here in the pre_tasks since it is for testing.
    - name: Set borg server openssh key variable
      become: true
      block:
        - name: Fetch ssh_key
          ansible.builtin.command: >
            ssh-keyscan -t rsa
            {{ borg_server_host }}
            | sed "s/^[^ ]* //"
          register: borg_server_ssh_keyscan
          changed_when: false

        - name: Set ssh_key
          ansible.builtin.set_fact:
            borg_server_host_ssh_key: "{{ borg_server_ssh_keyscan.stdout
              | split(' ')
              | reject('search', borg_server_host)
              | join(' ') }}"

  vars:
    borg_server_host: borg-server
    borg_server_user_home: /opt/borg
    borg_decryption_keys_yaml_path: "{{ playbook_dir }}/decryption_keys.yml"
    borg_included_dirs:
      - /etc
      - /home
    borg_excluded_dirs:
      - /opt
      - /var
      - /reee reeee
    borg_cron_time:
      minute: "*"
      hour: "*"

  roles:
    - role: kliwniloc.borgbackup