How to configure network interfaces on Ubuntu and CentOS with Ansible variables?

Viewed 959

I am searching for an OS-independent version of https://github.com/linux-system-roles/network:

  • It should work for Debian>=10, Ubuntu>=18.04 and CentOS>=8
  • It should support interface bonding
  • The network interfaces should be configurable with host variables, similar to this:
- name: NIC Configuration 
  hosts: webservers
  vars:
    network_connections: 
      - name: ens4
        type: ethernet
        ip:
          address:
            - 172.25.250.30/24
  roles:
    - rhel-system-roles.network

Are there any roles like this?

I do know the community.general.nmcli module, however, the example there looks quite complicated: ansible-nmcli does not allow to configure the network via variables, instead one has to set the role parameters by hand.

0 Answers
Related