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: borg:
ansible-playbook playbooks/borg.yml -i inventory/hosts.yml --ask-vault-pass ansible-playbook playbooks/borg.yml -i inventory/hosts.yml --ask-vault-pass
dataserver:
ansible-playbook playbooks/dataserver.yml -i inventory/hosts.yml
.PHONY: run .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: all:
children: children:
homeservers: homeserver:
hosts: hosts:
max: max:
ansible_user: root ansible_user: root
ansible_host: max.lan ansible_host: max.lan
dataserver:
hosts:
lewis:
ansible_user: root
ansible_host: lewis.lan

View file

@ -1,5 +1,5 @@
- name: Setup everything - name: Setup homeserver
hosts: homeservers hosts: homeserver
roles: roles:
- ssh - ssh
- borg - borg
@ -10,3 +10,7 @@
- forgejo - forgejo
- radicale - radicale
- mastodon - mastodon
- name: Setup dataserver
hosts: dataserver
roles:
- dataserver

View file

@ -1,4 +1,4 @@
- name: Install borg - name: Install borg
hosts: homeservers hosts: homeserver
roles: roles:
- borg - 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 - name: Configure firewall
hosts: homeservers hosts: homeserver
roles: roles:
- firewall - firewall

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -11,11 +11,6 @@
template: template:
src: "{{ role_path }}/templates/backup.yml.j2" src: "{{ role_path }}/templates/backup.yml.j2"
dest: "{{ service_dir }}/backup.yml" 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 - name: Copy private key
copy: copy:
src: "{{ role_path }}/files/id_ed25519" src: "{{ role_path }}/files/id_ed25519"

View file

@ -2,7 +2,7 @@ location:
source_directories: source_directories:
- {{ base_data_dir }} - {{ base_data_dir }}
repositories: repositories:
- ssh://root@lewis.lan/root/homeserver_backup - ssh://root@lewis.lan/{{ backup_location }}
retention: retention:
keep_daily: 7 keep_daily: 7
keep_weekly: 4 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 }}"