add data server

This commit is contained in:
pizzaniels 2023-01-11 20:04:31 +01:00
parent 2895d00e60
commit 812ba00884
20 changed files with 51 additions and 21 deletions

View file

@ -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

View file

@ -0,0 +1,2 @@
borg_public_key: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBTag7YToG5W+H2kEUz40kOH+7cs0Lp3owFFKkmHBiWM root@max"
backup_location: "/root/homeserver_backup"

View file

@ -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

View file

@ -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

View file

@ -1,4 +1,4 @@
- name: Install borg
hosts: homeservers
hosts: homeserver
roles:
- borg

4
playbooks/dataserver.yml Normal file
View file

@ -0,0 +1,4 @@
- name: Install dataserver
hosts: dataserver
roles:
- dataserver

View file

@ -1,4 +1,4 @@
- name: Configure firewall
hosts: homeservers
hosts: homeserver
roles:
- firewall

View file

@ -1,4 +1,4 @@
- name: Install forgejo
hosts: homeservers
hosts: homeserver
roles:
- forgejo

View file

@ -1,4 +1,4 @@
- name: Install kms stateless server
hosts: homeservers
hosts: homeserver
roles:
- kms

View file

@ -1,4 +1,4 @@
- name: Install Mastodon
hosts: homeservers
hosts: homeserver
roles:
- mastodon

View file

@ -1,4 +1,4 @@
- name: Install nsd
hosts: homeservers
hosts: homeserver
roles:
- nsd

View file

@ -1,4 +1,4 @@
- name: Install pizzeria static website
hosts: homeservers
hosts: homeserver
roles:
- pizzeria

View file

@ -1,4 +1,4 @@
- name: Install Radicale
hosts: homeservers
hosts: homeserver
roles:
- radicale

View file

@ -1,4 +1,4 @@
- name: Configure SSH
hosts: homeservers
hosts: homeserver
roles:
- ssh

View file

@ -1,4 +1,4 @@
- name: Install syncthing
hosts: homeservers
hosts: homeserver
roles:
- syncthing

View file

@ -1,4 +1,4 @@
- name: Install traefik
hosts: homeservers
hosts: homeserver
roles:
- traefik

View file

@ -1 +0,0 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBTag7YToG5W+H2kEUz40kOH+7cs0Lp3owFFKkmHBiWM root@max

View file

@ -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"

View file

@ -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

View 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 }}"