Clean networking deployment for Ansible

Hi,

I would like to deploy network configuration to some FreeBSD machines. I have simple setups with just a NIC and static addresses. I also have setups with bridging and vlan so I can put my iocage jails into a specific vlan.

Before I start writing a new Ansible role I just wanted to check with you. My approach would be to make sure that /etc/rc.conf is free of any network configuration whatsoever. I don't want to use Ansible builtins like lineinfile or replace. That would be extremely cumbersome and error prone.
Instead I would like to generate clean networking only files and then put them somewhere, but where?

Might that be possible or does the networking config has to be in /etc/rc.conf
Juni
 
From the rc.conf(5) man page:
The file /etc/defaults/vendor.conf allows vendors to override FreeBSD defaults...
In addition to /etc/rc.conf.local you can also place smaller configura-
tion files for each rc(8) script in the /etc/rc.conf.d directory or
<dir>/rc.conf.d directories specified in local_startup, which will be in-
cluded by the load_rc_config function...
 
I just tried on a freshly installed system to put those lines into /etc/rc.conf.d/network and purged them from /etc/rc.conf
Code:
ifconfig_vtnet0="inet 10.10.129.8 netmask 255.255.255.192"
defaultrouter="10.10.129.1"
ifconfig_vtnet0_ipv6="inet6 2001:1234:4321:7300::f/64"
ipv6_defaultrouter="2001:1234:4321:7300::1"
The IP addresses are being set but no default gateways.
I will try different setups and split everything up, meaning default routes into rc.conf and everything else into dedicated file. I'll keep you updated.
 
Currently I'm trying to create bridges with children and static IP addresses.
My resulting config looks like this:
Code:
cloned_interfaces="bridge0 bridge1"
ifconfig_bridge0="addm vtnet0 up"
ifconfig_vtnet0="up"
ifconfig_bridge0="inet 10.10.129.8 netmask 255.255.255.0"
ifconfig_bridge0_ipv6="inet6 2001:1234:4321:7300::f prefixlen 64 auto_linklocal"
Yet when the system boots up the vtnet0 child is missing on the bridge.
The moment I run ifconfig bridge0 addm vtnet0 up everything is up and running. Does somebody have an idea why that is? I cannot find the error.
 
I was looking into configuring rc.conf with Ansible and found this unanswered post.
For anyone searching for a solution, it can be found here:
 
Back
Top