69 lines
1.3 KiB
YAML
69 lines
1.3 KiB
YAML
---
|
|
|
|
- name: Install needed packages
|
|
become: true
|
|
ansible.builtin.apt:
|
|
name:
|
|
- borgbackup
|
|
- acl # for become_user: borg
|
|
|
|
- name: Create a LV for /var/lib/borg
|
|
become: true
|
|
community.general.lvol:
|
|
vg: "vg_{{ ansible_hostname }}"
|
|
lv: borg
|
|
state: present
|
|
size: 5g
|
|
resizefs: true
|
|
|
|
- name: Format borg LV to ext4
|
|
become: true
|
|
community.general.filesystem:
|
|
dev: "/dev/vg_{{ ansible_hostname }}/borg"
|
|
fstype: ext4
|
|
resizefs: true
|
|
state: present
|
|
|
|
- name: Mount /var/lib/borg
|
|
become: true
|
|
ansible.posix.mount:
|
|
src: "/dev/vg_{{ ansible_hostname }}/borg"
|
|
path: /var/lib/borg
|
|
state: mounted
|
|
fstype: ext4
|
|
|
|
- name: Create borg group
|
|
become: true
|
|
ansible.builtin.group:
|
|
name: borg
|
|
system: true
|
|
state: present
|
|
|
|
- name: Create borg user
|
|
become: true
|
|
ansible.builtin.user:
|
|
name: borg
|
|
group: borg
|
|
home: /var/lib/borg
|
|
create_home: false
|
|
shell: /bin/bash
|
|
system: true
|
|
|
|
- name: Set ownership for /var/lib/borg
|
|
become: true
|
|
ansible.builtin.file:
|
|
path: /var/lib/borg
|
|
state: directory
|
|
owner: borg
|
|
group: borg
|
|
recurse: true
|
|
|
|
- name: Create ~/.ssh dir
|
|
become: true
|
|
become_user: borg
|
|
ansible.builtin.file:
|
|
path: ~/.ssh
|
|
state: directory
|
|
owner: borg
|
|
group: borg
|
|
mode: 0700
|