infrastructure/ansible/plays/backup.yaml
Tobias Manske 0ed91a92c6
All checks were successful
continuous-integration/drone/push Build is passing
Move storagebox to cifs share for better performance
2024-01-06 02:55:24 +01:00

62 lines
1.8 KiB
YAML

- name: Setup Infra Meta Host
hosts: backup.unruhig.eu
gather_facts: false
tasks:
- name: Create user [backup]
become: true
ansible.builtin.user:
name: backup
comment: Used for receiving borg backups
shell: /bin/bash
create_home: true
state: present
generate_ssh_key: true
ssh_key_type: "ed25519"
ssh_key_file: ".ssh/storagebox"
- name: Create mount directory
become: true
become_user: backup
ansible.builtin.file:
path: "/home/backup/storagebox"
state: directory
- name: Create systemd user config directory
become: true
become_user: backup
ansible.builtin.file:
path: "/home/backup/.config/systemd/user"
state: directory
- name: Create mount unit
become: true
become_user: root
ansible.builtin.template:
src: mount-storagebox.mount.j2
owner: root
group: root
mode: "0600" # Credentials
dest: /etc/systemd/system/var-home-backup-storagebox.mount
- name: Create automount unit
become: true
become_user: root
ansible.builtin.template:
src: mount-storagebox.automount.j2
dest: /etc/systemd/system/var-home-backup-storagebox.automount
owner: root
group: root
mode: "0644"
- name: Start storagebox Mount Service
become: true
become_user: root
ansible.builtin.systemd:
name: var-home-backup-storagebox.mount
state: started
enabled: true
daemon_reload: true
- name: enable storagebox automount Mount Unit
become: true
become_user: root
ansible.builtin.systemd:
name: var-home-backup-storagebox.automount
enabled: true
# vim: ft=yaml.ansible