Add the core_ethernet variable, naming Core's Ethernet interface.
authorMatt Birkholz <matt@birchwood-abbey.net>
Sat, 24 Feb 2024 01:27:06 +0000 (18:27 -0700)
committerMatt Birkholz <matt@birchwood-abbey.net>
Sat, 24 Feb 2024 01:27:06 +0000 (18:27 -0700)
This should be derivable from ansible_facts, somehow.

README.org
private/vars.yml
roles_t/core/tasks/main.yml

index 0864bfc7d7f144938a2ef092330d89026f97c3e6..da4f608593fff4e04ff1f04f01c7e166bd17d32b 100644 (file)
@@ -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
index a4a8e52ea70400bfba86eff3c4cfb6fd07aeb500..54ca554e0bd78bcb0c662a8c569734a8f027c142 100644 (file)
@@ -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
index d3053213ef2a6c70e6a09e225b108f4921efebc0..872a72d04718cf3b26de8232e5b47e64f9ba4377 100644 (file)
@@ -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.