1
1
Fork 0
mirror of https://gitlab.archlinux.org/archlinux/infrastructure.git synced 2024-06-02 13:06:09 +02:00
infrastructure/playbooks/fetch-borg-keys.yml
Florian Pritz ea7a38feb4
playbooks/fetch-borg-keys.yml: Encrypt keys with GPG
Signed-off-by: Florian Pritz <bluewind@xinu.at>
2018-01-10 21:02:25 +01:00

21 lines
658 B
YAML

---
- name: prepare local storage directory
hosts: 127.0.0.1
tasks:
- file: path="{{playbook_dir}}/../borg-keys/" state=directory
- name: fetch borg keys
hosts: borg-clients
tasks:
- name: fetch borg key
command: "/usr/local/bin/borg key export :: /dev/stdout"
register: borg_key
- name: save borg key
shell: gpg --batch --armor --encrypt --output - >"{{playbook_dir}}/../borg-keys/{{inventory_hostname}}.gpg" {% for userid in root_gpgkeys %}--recipient {{userid}} {% endfor %}
args:
stdin: "{{borg_key.stdout}}"
chdir: "{{playbook_dir}}/.."
delegate_to: localhost