add data server
This commit is contained in:
parent
2895d00e60
commit
812ba00884
20 changed files with 51 additions and 21 deletions
3
Makefile
3
Makefile
|
@ -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
|
||||||
|
|
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:
|
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
|
||||||
|
|
|
@ -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
|
|
@ -1,4 +1,4 @@
|
||||||
- name: Install borg
|
- name: Install borg
|
||||||
hosts: homeservers
|
hosts: homeserver
|
||||||
roles:
|
roles:
|
||||||
- borg
|
- 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
|
- name: Configure firewall
|
||||||
hosts: homeservers
|
hosts: homeserver
|
||||||
roles:
|
roles:
|
||||||
- firewall
|
- firewall
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- name: Install forgejo
|
- name: Install forgejo
|
||||||
hosts: homeservers
|
hosts: homeserver
|
||||||
roles:
|
roles:
|
||||||
- forgejo
|
- forgejo
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- name: Install kms stateless server
|
- name: Install kms stateless server
|
||||||
hosts: homeservers
|
hosts: homeserver
|
||||||
roles:
|
roles:
|
||||||
- kms
|
- kms
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- name: Install Mastodon
|
- name: Install Mastodon
|
||||||
hosts: homeservers
|
hosts: homeserver
|
||||||
roles:
|
roles:
|
||||||
- mastodon
|
- mastodon
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- name: Install nsd
|
- name: Install nsd
|
||||||
hosts: homeservers
|
hosts: homeserver
|
||||||
roles:
|
roles:
|
||||||
- nsd
|
- nsd
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- name: Install pizzeria static website
|
- name: Install pizzeria static website
|
||||||
hosts: homeservers
|
hosts: homeserver
|
||||||
roles:
|
roles:
|
||||||
- pizzeria
|
- pizzeria
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- name: Install Radicale
|
- name: Install Radicale
|
||||||
hosts: homeservers
|
hosts: homeserver
|
||||||
roles:
|
roles:
|
||||||
- radicale
|
- radicale
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- name: Configure SSH
|
- name: Configure SSH
|
||||||
hosts: homeservers
|
hosts: homeserver
|
||||||
roles:
|
roles:
|
||||||
- ssh
|
- ssh
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- name: Install syncthing
|
- name: Install syncthing
|
||||||
hosts: homeservers
|
hosts: homeserver
|
||||||
roles:
|
roles:
|
||||||
- syncthing
|
- syncthing
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- name: Install traefik
|
- name: Install traefik
|
||||||
hosts: homeservers
|
hosts: homeserver
|
||||||
roles:
|
roles:
|
||||||
- traefik
|
- traefik
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBTag7YToG5W+H2kEUz40kOH+7cs0Lp3owFFKkmHBiWM root@max
|
|
|
@ -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"
|
||||||
|
|
|
@ -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
|
||||||
|
|
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