2023-02-25 14:35:35 +00:00
|
|
|
- name: Setup homeserver
|
|
|
|
hosts: dataserver
|
2023-04-25 19:59:11 +00:00
|
|
|
|
|
|
|
handlers:
|
|
|
|
- name: restart sshd
|
|
|
|
systemd:
|
|
|
|
name: sshd
|
|
|
|
state: restarted
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
- name: Copy backup user principals file
|
|
|
|
copy:
|
|
|
|
dest: /etc/ssh/backup_principals
|
|
|
|
content: hypervisor
|
|
|
|
|
|
|
|
- name: Copy hyp user SSH CA public key
|
|
|
|
copy:
|
|
|
|
dest: /etc/ssh/hyp_user.pub
|
|
|
|
content: "{{ hyp_user_ca_public_key }}"
|
|
|
|
|
|
|
|
- name: Copy user certificate sshd config
|
|
|
|
copy:
|
|
|
|
src: "sshd_user_certificates.conf"
|
|
|
|
dest: /etc/ssh/sshd_config.d/user_certificates.conf
|
|
|
|
notify: restart sshd
|
|
|
|
|
|
|
|
- name: Ensure backup directory exists
|
|
|
|
file:
|
2023-05-15 20:19:34 +00:00
|
|
|
path: "{{ backup_mount_point }}/hosts"
|
2023-04-25 19:59:11 +00:00
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: Create backup respositories
|
|
|
|
command:
|
2023-05-15 20:19:34 +00:00
|
|
|
cmd: "borg init -e none {{ backup_mount_point }}/hosts/{{ item }}"
|
|
|
|
creates: "{{ backup_mount_point }}/hosts/{{ item }}"
|
2023-04-25 19:59:11 +00:00
|
|
|
with_items: "{{ backup_hosts }}"
|
|
|
|
|
|
|
|
- name: Create extra disk moint point
|
|
|
|
file:
|
2023-05-15 20:19:34 +00:00
|
|
|
path: "{{ backup_mount_point }}"
|
2023-04-25 19:59:11 +00:00
|
|
|
state: directory
|
|
|
|
|
|
|
|
- name: Mount extra disk
|
2023-05-15 20:19:34 +00:00
|
|
|
mount:
|
|
|
|
path: "{{ backup_mount_point }}"
|
|
|
|
src: "UUID={{ backup_uuid }}"
|
2023-04-25 19:59:11 +00:00
|
|
|
fstype: ext4
|
|
|
|
passno: 1
|
|
|
|
state: present
|
|
|
|
|
2023-02-25 14:35:35 +00:00
|
|
|
roles:
|
2023-04-26 17:39:36 +00:00
|
|
|
- {role: apt, tags: apt}
|
|
|
|
- {role: deploy_ssh_certificates, tags: deploy_ssh_certificates}
|
2023-05-15 20:19:34 +00:00
|
|
|
# - {role: docker, tags: docker}
|
|
|
|
# - {role: uptime_kuma, tags: uptime_kuma}
|
|
|
|
# - {role: alerts, tags: alerts}
|