This repository has been archived on 2023-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
max/roles/dataserver/tasks/main.yml

34 lines
916 B
YAML
Raw Normal View History

- name: Add admins' authorized keys
authorized_key:
key: "{{ item }}"
user: "{{ ansible_user_id }}"
loop: "{{ admin_public_keys }}"
- name: Copy host public key
template:
src: "{{ role_path }}/templates/ssh_host_ed25519_key.pub.j2"
dest: "/etc/ssh/ssh_host_ed25519_key.pub"
mode: 0644
- name: Copy host private key
copy:
src: "{{ role_path }}/files/ssh_host_ed25519_key"
dest: "/etc/ssh/ssh_host_ed25519_key"
mode: 0600
2023-01-11 19:04:31 +00:00
- name: APT upgrade
apt:
autoremove: true
upgrade: yes
state: latest
update_cache: yes
cache_valid_time: 86400 # One day
- name: Install borg
apt:
name: borgbackup
- name: Add Borg public key
authorized_key:
key: "ssh-ed25519 {{ borg_public_key }} root@max"
2023-01-11 19:04:31 +00:00
user: "{{ ansible_user_id }}"
- name: Create Borg repository
command:
cmd: "borg init -e none {{ backup_location }}"
creates: "{{ backup_location }}"