Merge branch 'master' of ssh://git.pizzapim.nl:56287/pim/homeservers
This commit is contained in:
commit
30a87cef3c
20 changed files with 51 additions and 21 deletions
3
Makefile
3
Makefile
|
@ -31,4 +31,7 @@ kms:
|
|||
borg:
|
||||
ansible-playbook playbooks/borg.yml -i inventory/hosts.yml --ask-vault-pass
|
||||
|
||||
dataserver:
|
||||
ansible-playbook playbooks/dataserver.yml -i inventory/hosts.yml
|
||||
|
||||
.PHONY: run
|
||||
|
|
2
inventory/group_vars/all.yml
Normal file
2
inventory/group_vars/all.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
borg_public_key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBTag7YToG5W+H2kEUz40kOH+7cs0Lp3owFFKkmHBiWM root@max"
|
||||
backup_location: "/root/homeserver_backup"
|
|
@ -1,7 +1,12 @@
|
|||
all:
|
||||
children:
|
||||
homeservers:
|
||||
homeserver:
|
||||
hosts:
|
||||
max:
|
||||
ansible_user: root
|
||||
ansible_host: max.lan
|
||||
dataserver:
|
||||
hosts:
|
||||
lewis:
|
||||
ansible_user: root
|
||||
ansible_host: lewis.lan
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- name: Setup everything
|
||||
hosts: homeservers
|
||||
- name: Setup homeserver
|
||||
hosts: homeserver
|
||||
roles:
|
||||
- ssh
|
||||
- borg
|
||||
|
@ -10,3 +10,7 @@
|
|||
- forgejo
|
||||
- radicale
|
||||
- mastodon
|
||||
- name: Setup dataserver
|
||||
hosts: dataserver
|
||||
roles:
|
||||
- dataserver
|
|
@ -1,4 +1,4 @@
|
|||
- name: Install borg
|
||||
hosts: homeservers
|
||||
hosts: homeserver
|
||||
roles:
|
||||
- borg
|
||||
|
|
4
playbooks/dataserver.yml
Normal file
4
playbooks/dataserver.yml
Normal file
|
@ -0,0 +1,4 @@
|
|||
- name: Install dataserver
|
||||
hosts: dataserver
|
||||
roles:
|
||||
- dataserver
|
|
@ -1,4 +1,4 @@
|
|||
- name: Configure firewall
|
||||
hosts: homeservers
|
||||
hosts: homeserver
|
||||
roles:
|
||||
- firewall
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- name: Install forgejo
|
||||
hosts: homeservers
|
||||
hosts: homeserver
|
||||
roles:
|
||||
- forgejo
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- name: Install kms stateless server
|
||||
hosts: homeservers
|
||||
hosts: homeserver
|
||||
roles:
|
||||
- kms
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- name: Install Mastodon
|
||||
hosts: homeservers
|
||||
hosts: homeserver
|
||||
roles:
|
||||
- mastodon
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- name: Install nsd
|
||||
hosts: homeservers
|
||||
hosts: homeserver
|
||||
roles:
|
||||
- nsd
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- name: Install pizzeria static website
|
||||
hosts: homeservers
|
||||
hosts: homeserver
|
||||
roles:
|
||||
- pizzeria
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- name: Install Radicale
|
||||
hosts: homeservers
|
||||
hosts: homeserver
|
||||
roles:
|
||||
- radicale
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- name: Configure SSH
|
||||
hosts: homeservers
|
||||
hosts: homeserver
|
||||
roles:
|
||||
- ssh
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- name: Install syncthing
|
||||
hosts: homeservers
|
||||
hosts: homeserver
|
||||
roles:
|
||||
- syncthing
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- name: Install traefik
|
||||
hosts: homeservers
|
||||
hosts: homeserver
|
||||
roles:
|
||||
- traefik
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBTag7YToG5W+H2kEUz40kOH+7cs0Lp3owFFKkmHBiWM root@max
|
|
@ -11,11 +11,6 @@
|
|||
template:
|
||||
src: "{{ role_path }}/templates/backup.yml.j2"
|
||||
dest: "{{ service_dir }}/backup.yml"
|
||||
- name: Copy public key
|
||||
copy:
|
||||
src: "{{ role_path }}/files/id_ed25519.pub"
|
||||
dest: "{{ service_dir }}/id_ed25519.pub"
|
||||
mode: 0644
|
||||
- name: Copy private key
|
||||
copy:
|
||||
src: "{{ role_path }}/files/id_ed25519"
|
||||
|
|
|
@ -2,7 +2,7 @@ location:
|
|||
source_directories:
|
||||
- {{ base_data_dir }}
|
||||
repositories:
|
||||
- ssh://root@lewis.lan/root/homeserver_backup
|
||||
- ssh://root@lewis.lan/{{ backup_location }}
|
||||
retention:
|
||||
keep_daily: 7
|
||||
keep_weekly: 4
|
||||
|
|
18
roles/dataserver/tasks/main.yml
Normal file
18
roles/dataserver/tasks/main.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
- 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: "{{ borg_public_key }}"
|
||||
user: "{{ ansible_user_id }}"
|
||||
- name: Create Borg repository
|
||||
command:
|
||||
cmd: "borg init -e none {{ backup_location }}"
|
||||
creates: "{{ backup_location }}"
|
Reference in a new issue