Now configuring magic-router as well

This commit is contained in:
Pünkösd Marcell 2021-11-12 00:36:16 +01:00
parent a306d9e56c
commit 35590f4e59
6 changed files with 70 additions and 7 deletions

View File

@ -0,0 +1,32 @@
network:
version: 2
ethernets:
# cloud
enp1s0f0:
dhcp4: false
dhcp6: false
gateway4: 192.168.110.1
addresses:
- "192.168.110.10/24"
# edge-1
enp1s0f1:
dhcp4: false
dhcp6: false
addresses:
- "192.168.111.10/24"
# edge-2
enp1s0f2:
dhcp4: false
dhcp6: false
addresses:
- "192.168.112.10/24"
# site
enp1s0f3:
dhcp4: false
dhcp6: false
addresses:
- "192.168.113.10/24"

View File

@ -13,7 +13,6 @@ cloud-1:
cloud-cluster-1-worker-1:
cloud-cluster-1-worker-2:
edge-1:
vars:
magic_router_ip: 192.168.111.10
@ -56,9 +55,21 @@ site-1:
hosts:
site-emulator-1:
all:
networking:
vars:
ansible_become: true
ansible_user: ubuntu
hosts:
magic-router:
kubernetes:
children:
cloud-1:
edge-1:
edge-2:
all:
children:
networking:
kubernetes:
site-1:

View File

@ -12,6 +12,10 @@
state: restarted
tasks:
- name: "fix dns"
import_tasks: tasks/fix-dns-resolution.yaml
- name: "do apt stuff"
import_tasks: tasks/apt.yaml
@ -24,8 +28,9 @@
- name: "clean motd"
import_tasks: tasks/clean-motd.yaml
- name: "fix dns"
import_tasks: tasks/fix-dns-resolution.yaml
- name: "setup static route"
import_tasks: tasks/setup-static-route.yaml
import_tasks: tasks/setup-static-route.yaml
- name: "setup router stuff"
import_tasks: tasks/enable-routing.yaml
when: ansible_host == "magic-router"

View File

@ -6,6 +6,7 @@
- name: "Install my favourite applications"
apt:
update_cache: true
state: present
name:
- tmux

View File

@ -0,0 +1,6 @@
- name: enable routing in sysctl config
ansible.posix.sysctl:
name: net.ipv4.ip_forward
value: 1
state: present
reload: true

View File

@ -7,4 +7,12 @@
template:
src: templates/netplan.yaml
dest: /etc/netplan/00-static.yaml
notify: netplanapply
notify: netplanapply
when: ansible_host != "magic-router"
- name: "install static config for magic router"
copy:
src: files/magic_router_netplan.yaml
dest: /etc/netplan/00-static.yaml
notify: netplanapply
when: ansible_host == "magic-router"