oO.o's Neverending Tech Blog

In my Ansible network role, for Linux hosts, I am going through and checking for netplan, network manager, ifplugd and networkd (in that order) and configure based on first match. Only reason I like netplan more now is because dumping config to yaml in Ansible is very easy. If it was available on RHEL distros, I’d probably just install it as a package dependency for the role, but since I’m already accommodating multiple things, I figure I’d hit them all.

Luckily, Ansible does all the work of getting IP addresses and whatnot, so I only have to deal with this on configuration… Sucks there’s no cross-platform network module that can configure interfaces, but given the complexity, I understand why no one wants to touch it.

2 Likes

TBH, under CentOS, Fedora and to some extend Ubuntu, NetworkManager wasn’t that bad. It did its job pretty well. I had all kinds of settings, static, dhcp, just manual dns, it just worked for me. But I don’t remember on what I tried it that made me bang my head against the wall, I think it was on Debian. But on the other hand, Debian’s network interfaces conf file works wonderful, that is, if the interface names don’t change randomly after every dang reboot (I only had this issue on a single server, but it was really persistent, getting int names like “named6” and “named7” IIRC, alongside the classical enp* or similar, I had 6 interfaces).

Netplan, besides me not being used to its config parameters and always forgetting that tab doesn’t equal 4 spaces (I since started only using spaces and removing tabs from any document I create, unless vim or nvim does s**t to change spaces into tabs), has also been pretty well behaved.

To me, the worst network configuration and management tool is by far Wicked. Not sure what I have done and keep doing wrong, but it never seems to work, even when trying to use DHCP, for god’s sake!

2 Likes

Ordered a batch of these. Going to evaluate them for router/gateway use. Looks promising. Radically cheaper than anything else I’ve seen.

For reference, here is the thin client I use as my router at home which is double the price I paid for it in I think 2017:

5 Likes

I’m kind of embarrassed, I’ve opened 2 long, detailed tickets with Ansible core recently just to close them within an hour after I realized my mistake… I hope they were brief enough I didn’t waste anyone’s time.

7 Likes

Rubber ducky debugging strikes again!

2 Likes

Better way to do this?

  - name: Enumerate used IP addresses
    ansible.builtin.set_fact:
      used_ips: "{{ groups['all']
                    | map('extract', hostvars, 'ansible_all_ipv4_addresses')
                    | select('defined')
                    | flatten
                    | unique }}"
3 Likes

Getting close to my first Expert+ win in Beat Saber. I notice I do best a few hours after a run.

5 Likes

So I am trimming network support in my Ansible collection down to just Network Manager and networkd. I found that netplan produces 10- networkd files, so you can supersede them with 0009 prefixed config in Ubuntu. Additionally, Debian ships with networkd because what doesn’t?

I will still use Network Manager in RHEL or anything else where it’s present because I expect that a lot of RHEL things expect it to be there (FreeIPA, OpenShift, etc), but otherwise, I’m going to fall back to networkd.


Also, working through the networkd config, you really see why people complain about systemd. You can configure routes, firewall, dns, dhcp server and all sorts of other things in the interface config. No wonder it’s such a tangled mess.

5 Likes

I hate Gnome documentation, and increasingly, NetworkManager…

I love nmcli but otherwise not a fan right now.


Derp, I forgot that nmcli can save the configuration so you don’t have to mess with the config files at all… my bad.

lol that I hadn’t used network manager in so long I remembered I liked nmcli but forgot that I liked it because it managed persistent config…

3 Likes

Beware community.general

  # Idempotence appears to be broken here so we check manually that the
  # IP address isn't already set
  - name: >
      Configure {{nm_con_name}} ({{current_iface['dev']}}) with IP
      {{current_iface_ip}}
    community.general.nmcli:
      conn_name: "{{nm_con_name}}"
      type: "{{nm_iface_type}}"
      ip4: "{{current_iface_ip}}/{{current_mask}}"
      state: present
    become: yes
    when:
    - current_iface_ip | default() | ansible.netcommon.ipv4
    - >
      ( ansible_facts[current_iface['dev']]['ipv4']['address']
        | default('0')
        + '/'
        + ansible_facts[current_iface['dev']]['ipv4']['netmask']
        | default('0') )
      | ansible.netcommon.ipaddr('host/prefix')
      !=
      ( current_iface_ip | default()
        + '/'
        + current_mask
        | default()
        | string )
    notify: restart network
  # community.general.nmcli only allows random mac on wifi type
  # interfaces
  - name: "Randomize {{current_iface['dev']}} MAC address"
    block:

    - name: "{{current_iface['dev']}} MAC address is already randomized"
      ansible.builtin.shell:
        cmd: >
          nmcli --get-values 802-3-ethernet.cloned-mac-address connection show
          {{nm_con_name}}
      become: yes
      register: mac_addr_rand_reg
      changed_when: false
      failed_when: mac_addr_rand_reg['stdout_lines'][0] | default() != 'random'

    rescue:

    - name: "Configure random MAC address for {{current_iface['dev']}}"
      ansible.builtin.shell:
        cmd: >
          nmcli connection modify {{nm_con_name}}
          802-3-ethernet.cloned-mac-address random
      become: yes
      when: not ansible_check_mode
      notify: restart network

    when: current_iface['random_mac'] | default(true)
2 Likes

Void doesn’t :wink:
Wait, I thought Debian still uses /etc/network/interfaces as of Debain 11 by default. Alpine also uses /etc/network/interfaces. It’s just Void that uses dhcpd / dhclient or for static, ip commands under /etc/rc.local file. It always gets me.

To be honest, I’m used to both network/interfaces and in RHEL family, /etc/sysconfig/network-scripts/ifcfg-e*, I find that easier than nmcli. I did use nmcli on Fedora on my work laptop, but when I was configuring static IPs on CentOS, I just did the network-scripts conf file. And you can either allow it to be controlled by NetworkManager or not under that conf. I may be wrong, but I think you have the option / parameter “save config” for network-scripts, which I never actually understood how it works, but makes the config actually work upon reboot.

1 Like

It does, but afaik, networkd is available in vanilla installs of all systemd distros, so you can disable ifupdown and/or Network Manager and use it instead.

This is actually a RHEL plugin for Network Manager. The native Network Manager config is /etc/NetworkManager/system-connections/. I did have trouble using that on Fedora though. It seemed to insist I use network-scripts which would have made my Ansible role less portable, so I used nmcli instead which will utilize whichever backend plugin is available.

Yes but afaik, disabling the NetworkManager control in the network-scripts conf file disables that conf entirely.

I’m not sure, but you may be thinking of the interactive nmcli edit mode in which you configure and then save similar to how you would configure a router.

3 Likes

I think so did I, which is why I used nmcli too.

oh, didn’t know that!

I’m not sure how it works in newer RHEL releases, but in CentOS 7 and I think 8 too (at least the initial 8.0), I recall disabling networkmanager control did nothing to impact the config running (because we’ve ran with it disabled for a long time, until I started allowing networkmanager control over the file, I think the parameter I’m talking about was nmcontrolled or something), as long as you had that save config option enabled.

2 Likes

:exploding_head:

4 Likes

htmlq looks promising

2 Likes

So how are they? Whats their idle like assuming you have a kill-a-watt.

3 Likes

I’ll check. I installed openbsd on one via pxe but haven’t done anything else to it yet.

2 Likes

@mutation666 stock OpenBSD runs at 22W idle

4 Likes

RIP Python in stock macOS

https://developer.apple.com/documentation/macos-release-notes/macos-12_3-release-notes

2 Likes

Oh, ok. This isn’t that useful then… I figured you could at least run Debian.

3.1.2. Supported guest operating systems

OpenShift Virtualization guests can use the following operating systems:

  • Red Hat Enterprise Linux 6, 7, and 8.
  • Microsoft Windows Server 2012 R2, 2016, and 2019.
  • Microsoft Windows 10.

Other operating system templates shipped with OpenShift Virtualization are not supported.

2 Likes