From a6db42e9e4186ec2b95ba77522cda8f042536264 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Fri, 23 Feb 2024 18:27:06 -0700 Subject: [PATCH] Add the core_ethernet variable, naming Core's Ethernet interface. This should be derivable from ansible_facts, somehow. --- README.org | 19 +++++++++++++++++-- private/vars.yml | 2 ++ roles_t/core/tasks/main.yml | 4 ++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/README.org b/README.org index 0864bfc..da4f608 100644 --- a/README.org +++ b/README.org @@ -2480,6 +2480,16 @@ through Core itself to Front, is advertised to other hosts, but is not created here. It is created by OpenVPN when Core connects to Front's VPN. +Core's Netplan needs the name of its main (only) Ethernet interface, +an example of which is given here. (A clever way to extract that name +from ~ansible_facts~ would be appreciated. The ~ansible_default_ipv4~ +fact was an empty hash at first boot on a simulated campus Ethernet.) + +#+CAPTION: [[file:private/vars.yml][=private/vars.yml=]] +#+BEGIN_SRC conf :tangle private/vars.yml +core_ethernet: enp0s3 +#+END_SRC + #+CAPTION: [[file:roles_t/core/tasks/main.yml][=roles_t/core/tasks/main.yml=]] #+BEGIN_SRC conf :tangle roles_t/core/tasks/main.yml @@ -2494,7 +2504,7 @@ VPN. network: renderer: networkd ethernets: - {{ ansible_default_ipv4.interface }}: + {{ core_ethernet }}: dhcp4: false addresses: [ {{ core_addr_cidr }} ] nameservers: @@ -2575,7 +2585,7 @@ with the real [[file:private/core-dhcpd.conf][=private/core-dhcpd.conf=]] (/not/ become: yes lineinfile: path: /etc/default/isc-dhcp-server - line: INTERFACESv4="{{ ansible_default_ipv4.interface }}" + line: INTERFACESv4="{{ core_ethernet }}" regexp: ^INTERFACESv4= notify: Restart DHCP server. @@ -7030,6 +7040,11 @@ defaults, listed below, are fine. - General type of mail configuration: Internet Site - System mail name: core.small.private +Before shutting down, the name of the primary Ethernet interface +should be compared to the example variable setting in +[[file:private/vars.yml][=private/vars.yml=]]. The value assigned to ~core_ethernet~ should +match the interface name. + ~core~ can now move to the campus. It is shut down before the following ~VBoxManage~ command is executed. The command connects the machine's NIC to ~vboxnet0~, which simulates the campus's private diff --git a/private/vars.yml b/private/vars.yml index a4a8e52..54ca554 100644 --- a/private/vars.yml +++ b/private/vars.yml @@ -36,6 +36,8 @@ wifi_wan_addr: "{{ wifi_wan_addr_cidr | ipaddr('address') }}" front_private_addr: "{{ front_private_addr_cidr | ipaddr('address') }}" +core_ethernet: enp0s3 + nextcloud_dbpass: ippAgmaygyob nextcloud_region: US diff --git a/roles_t/core/tasks/main.yml b/roles_t/core/tasks/main.yml index d305321..872a72d 100644 --- a/roles_t/core/tasks/main.yml +++ b/roles_t/core/tasks/main.yml @@ -78,7 +78,7 @@ network: renderer: networkd ethernets: - {{ ansible_default_ipv4.interface }}: + {{ core_ethernet }}: dhcp4: false addresses: [ {{ core_addr_cidr }} ] nameservers: @@ -97,7 +97,7 @@ become: yes lineinfile: path: /etc/default/isc-dhcp-server - line: INTERFACESv4="{{ ansible_default_ipv4.interface }}" + line: INTERFACESv4="{{ core_ethernet }}" regexp: ^INTERFACESv4= notify: Restart DHCP server. -- 2.25.1