support for multiple hypervisors
This commit is contained in:
parent
8e72446652
commit
b9ad2e866a
9 changed files with 70 additions and 15 deletions
2
ansible/README.md
Normal file
2
ansible/README.md
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
Prerequisites on Ansible CONTROLLER:
|
||||||
|
- python3-netaddr
|
|
@ -4,6 +4,7 @@ inventory=inventory
|
||||||
vault_password_file=util/secret-service-client.sh
|
vault_password_file=util/secret-service-client.sh
|
||||||
interpreter_python=/usr/bin/python3
|
interpreter_python=/usr/bin/python3
|
||||||
host_key_checking = False
|
host_key_checking = False
|
||||||
|
remote_user = root
|
||||||
|
|
||||||
[diff]
|
[diff]
|
||||||
always = True
|
always = True
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
---
|
---
|
||||||
- name: Setup Atlas
|
- hosts: hypervisors
|
||||||
hosts: atlas
|
|
||||||
|
|
||||||
handlers:
|
handlers:
|
||||||
- name: enable interfaces
|
- name: enable interfaces
|
||||||
|
@ -12,12 +11,6 @@
|
||||||
timezone:
|
timezone:
|
||||||
name: Europe/Amsterdam
|
name: Europe/Amsterdam
|
||||||
|
|
||||||
- name: Copy interfaces configuration
|
|
||||||
copy:
|
|
||||||
src: dmz.conf
|
|
||||||
dest: /etc/network/interfaces.d/dmz.conf
|
|
||||||
notify: enable interfaces
|
|
||||||
|
|
||||||
- name: Create data directory
|
- name: Create data directory
|
||||||
file:
|
file:
|
||||||
path: /data
|
path: /data
|
||||||
|
@ -27,9 +20,30 @@
|
||||||
roles:
|
roles:
|
||||||
- {role: setup_apt, tags: setup_apt}
|
- {role: setup_apt, tags: setup_apt}
|
||||||
- {role: libvirt, tags: libvirt}
|
- {role: libvirt, tags: libvirt}
|
||||||
|
|
||||||
|
- hosts: atlas
|
||||||
|
|
||||||
|
roles:
|
||||||
- {role: postgresql, tags: postgresql}
|
- {role: postgresql, tags: postgresql}
|
||||||
- {role: wireguard, tags: wireguard}
|
|
||||||
- {role: ssh_ca, tags: ssh_ca}
|
- {role: ssh_ca, tags: ssh_ca}
|
||||||
|
|
||||||
|
- hosts: hypervisors
|
||||||
|
no_log: False
|
||||||
|
|
||||||
|
handlers:
|
||||||
|
- name: enable interfaces
|
||||||
|
command:
|
||||||
|
cmd: ifup -a
|
||||||
|
|
||||||
|
pre_tasks:
|
||||||
|
- name: Copy interfaces configuration
|
||||||
|
copy:
|
||||||
|
src: dmz.conf
|
||||||
|
dest: /etc/network/interfaces.d/dmz.conf
|
||||||
|
notify: enable interfaces
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- {role: wireguard, tags: wireguard}
|
||||||
- {role: ssh_ca_known_hosts, tags: ssh_ca_known_hosts}
|
- {role: ssh_ca_known_hosts, tags: ssh_ca_known_hosts}
|
||||||
- {role: deploy_ssh_certificates, tags: deploy_ssh_certificates}
|
- {role: deploy_ssh_certificates, tags: deploy_ssh_certificates}
|
||||||
- {role: borg, tags: borg}
|
- {role: borg, tags: borg}
|
5
ansible/inventory/host_vars/jefke/apt.yml
Normal file
5
ansible/inventory/host_vars/jefke/apt.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
apt_install_packages:
|
||||||
|
- qemu-kvm
|
||||||
|
- libvirt-daemon-system
|
||||||
|
- sudo
|
||||||
|
- bridge-utils
|
12
ansible/inventory/host_vars/jefke/ssh_certificates.yml
Normal file
12
ansible/inventory/host_vars/jefke/ssh_certificates.yml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
deploy_ssh_certificates:
|
||||||
|
- name: ssh_user_ed25519_key
|
||||||
|
type: user
|
||||||
|
key_type: ed25519
|
||||||
|
signing_key: hyp_user
|
||||||
|
host: jefke.hyp
|
||||||
|
principals: hypervisor
|
||||||
|
- name: ssh_host_ed25519_key
|
||||||
|
type: host
|
||||||
|
key_type: ed25519
|
||||||
|
signing_key: hyp_host
|
||||||
|
host: jefke.hyp
|
18
ansible/inventory/host_vars/jefke/wireguard.yml
Normal file
18
ansible/inventory/host_vars/jefke/wireguard.yml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
wireguard_addresses:
|
||||||
|
- "10.42.1.1/32"
|
||||||
|
wireguard_endpoint: "jefke.hyp"
|
||||||
|
wireguard_private_key: !vault |
|
||||||
|
$ANSIBLE_VAULT;1.1;AES256
|
||||||
|
36376161636365313033613362336239656164643430306437393866353036303938616136613933
|
||||||
|
6333613866643139653130393532613838353031613562350a663664633033353364303035353131
|
||||||
|
66363439353537323636313466303236393530653938393838373837366436316665343831623934
|
||||||
|
3234363066366235300a346636613930346466643566666265613733343266613030613765313161
|
||||||
|
63343133646566623264393533613733363735666432396366623737306232303761366465306164
|
||||||
|
3937653537316461376263613338373439313531383961623333
|
||||||
|
wireguard_unmanaged_peers:
|
||||||
|
pim:
|
||||||
|
public_key: "xQ1hkwpIf5x7Wkx1leQHXx3RK8fjGWt2ZmG9XUN3V08="
|
||||||
|
allowed_ips: "10.42.1.2/32"
|
||||||
|
niels:
|
||||||
|
public_key: "WJO/DQUJyDp4rFW291F2Ai51lotU2IC+OATu+5P3Jio="
|
||||||
|
allowed_ips: "10.42.1.3/32"
|
|
@ -1,5 +1,8 @@
|
||||||
all:
|
all:
|
||||||
hosts:
|
children:
|
||||||
atlas:
|
hypervisors:
|
||||||
ansible_host: atlas.hyp
|
hosts:
|
||||||
ansible_user: root
|
atlas:
|
||||||
|
ansible_host: atlas.hyp
|
||||||
|
jefke:
|
||||||
|
ansible_host: jefke.hyp
|
||||||
|
|
|
@ -2,7 +2,7 @@ location:
|
||||||
source_directories:
|
source_directories:
|
||||||
- /data
|
- /data
|
||||||
repositories:
|
repositories:
|
||||||
- 'ssh://root@lewis.hyp/mnt/kingston1TB/hosts/atlas'
|
- 'ssh://root@lewis.hyp/mnt/kingston1TB/hosts/{{ ansible_hostname }}'
|
||||||
retention:
|
retention:
|
||||||
keep_daily: 7
|
keep_daily: 7
|
||||||
keep_weekly: 4
|
keep_weekly: 4
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
pass=`secret-tool lookup ansible_vault atlas`
|
pass=`secret-tool lookup ansible_vault hypervisors`
|
||||||
retval=$?
|
retval=$?
|
||||||
|
|
||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
|
|
Reference in a new issue