ansible-taler-exchange

Ansible playbook to deploy a production Taler Exchange
Log | Files | Refs | README | LICENSE

main.yml (1481B)


      1 ---
      2 - name: Install Borg package
      3   ansible.builtin.apt:
      4     name:
      5       - borgbackup
      6     state: latest
      7   when: ansible_facts["os_family"] == 'Debian'
      8 
      9 - name: Setup group for borg backups from spec
     10   ansible.builtin.group:
     11     name: borg
     12     state: present
     13     system: false
     14 
     15 - name: Setup user for borg backups from spec
     16   ansible.builtin.user:
     17     name: borg
     18     group: borg
     19     password: "!"
     20     system: false
     21     create_home: true
     22     state: present
     23 
     24 - name: Ensure /home/borg/.ssh/ directory exists
     25   file:
     26     path: "/home/borg/.ssh/"
     27     state: directory
     28     owner: borg
     29     group: borg
     30     mode: "0755"
     31 
     32 - name: Place SSH public key for access by pixel
     33   ansible.builtin.template:
     34     src: files/home/borg/.ssh/authorized_keys
     35     dest: /home/borg/.ssh/authorized_keys
     36     owner: borg
     37     group: borg
     38     mode: "0644"
     39 
     40 - name: Initialize borg repository
     41   ansible.builtin.command:
     42     cmd: borg init --encryption=repokey pixel-backup
     43     chdir: /home/borg
     44     creates: /home/borg/pixel-backup/config
     45   environment:
     46     BORG_PASSPHRASE: "{{ pixel_borg_key }}"
     47   become: true
     48   become_user: borg
     49 
     50 - name: Export borg repository key
     51   ansible.builtin.shell:
     52     cmd: borg key export pixel-backup/ > borg-repo.key
     53     chdir: /home/borg
     54     creates: /home/borg/borg-repo.key
     55   environment:
     56     BORG_PASSPHRASE: "{{ pixel_borg_key }}"
     57   become: true
     58   become_user: borg
     59 
     60 - name: Export borg-repo.key to caller
     61   fetch:
     62     src: /home/borg/borg-repo.key
     63     dest: ../borg-repokey