Aisbergg.networkmanager

Ansible Role: aisbergg.networkmanager

This Ansible role helps you install and set up NetworkManager, as well as manage network connections on Debian, RedHat, and Arch Linux systems.

Requirements

None.

Role Variables

Variable Default Description
networkmanager_redhat_enablerepo Repository to enable when installing NetworkManager. Only for RedHat systems.
networkmanager_debian_repo {{ ansible_distribution_release }}-backports Repository used for the installation. Only for Debian systems.
networkmanager_extra_packages [] List of extra packages to install, for example, wireguard.
networkmanager_service_enabled true Enable the NetworkManager service.
networkmanager_service_state started Manage how the NetworkManager service runs. Choices:
  • reloaded
  • restarted
  • started
  • stopped
networkmanager_service_restart_on_change true Restart the NetworkManager service if changes are made to its configuration.
networkmanager_connections [] List of network connections. See details here.
networkmanager_config {} Primary configuration for NetworkManager. Options can be found in the NetworkManager.conf.5 manual. Provide options as key-value pairs. Check the examples below for correct format.
networkmanager_conf_d {} List of NetworkManager configurations to be added to the conf.d/ directory. Check examples below for correct format.

Dependencies

Requires the community.general collection.

Example Playbook

- hosts: all
  vars: 
    vars:
      networkmanager_service_enabled: true
      networkmanager_service_state: started
      
      networkmanager_config:
        logging:
          level: WARN
          domains: ALL

      networkmanager_conf_d:
        "mac-address":  # -> conf.d/mac-address.conf
          "device-mac-randomization":
            # "yes" is the default for scanning
            "wifi.scan-rand-mac-address": true

          "connection-mac-randomization":
            # Randomize MAC for every Ethernet connection
            "ethernet.cloned-mac-address": random
            # Generate a random MAC for each WiFi and keep both associated.
            "wifi.cloned-mac-address": random
      
      networkmanager_connections:
        # Set DNS servers on the default interface
        - name: "{{ ansible_default_ipv4.interface }}"
          type: "{{ 'ethernet' if ansible_default_ipv4.type == 'ether' else omit }}"
          dns4: ['9.9.9.9']
          dns4_search: example.org

  roles:
    - aisbergg.networkmanager

License

MIT

Author Information

Andre Lehmann (aisberg@posteo.de)

Informazioni sul progetto

Install and configure NetworkManager and manage network connections using nmcli on Linux systems.

Installa
ansible-galaxy install Aisbergg.networkmanager
Licenza
mit
Download
1k
Proprietario
DevOps, Go, Python, Bash, Ansible, Docker, GitLab-CI, Linux, MariaDB, PostgreSQL, Open Source, Communication Design, Running