Git Product home page Git Product logo

ansible-role-networkmanager's Introduction

Ansible Role: aisbergg.networkmanager

This Ansible role is used to install and configure NetworkManager, and also manage network connections on Debian, RedHat and Arch Linux distributions.

Requirements

None.

Role Variables

Variable Default Comments
networkmanager_redhat_enablerepo Repository to enable while installing NetworkManager. Applies only to RedHat systems.
networkmanager_debian_repo {{ ansible_distribution_release }}-backports Repository used for installation. Applies only to Debian systems.
networkmanager_extra_packages [] List of additional packages to be installed, e.g. wireguard.
networkmanager_service_enabled true Enable the NetworkManager service.
networkmanager_service_state started Manage the state of the NetworkManager service
Choices:
  • reloaded
  • restarted
  • started
  • stopped
networkmanager_service_restart_on_change true Restart NetworkManager service on configuration changes.
networkmanager_connections [] List of network connections. The parameters can be looked up here.
networkmanager_config {} Main NetworkManager configuration. Available options can be found in the NetworkManager.conf.5 manpage. The options need to be provided as key-value pairs. See Example Section below for the correct syntax.
networkmanager_conf_d {} List of NetworkManager configurations, that will be put into the conf.d/ directory. See Example Section below for the correct syntax.

Dependencies

Depends on 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 already 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 associate the two permanently.
            "wifi.cloned-mac-address": random
      
      networkmanager_connections:
        # set DNS resolvers on 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 ([email protected])

ansible-role-networkmanager's People

Contributors

aisbergg avatar stejoo avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

ansible-role-networkmanager's Issues

Incompatibility with (RH)EL8

Thanks for the role code ๐Ÿ‘
I have been using it for some time now, but ran into an issue today:

The role fails on a (current) RHEL8 system with the following error on task networkmanager : create main NetworkManager configuration (which deploys the NetworkManager.conf file):

AnsibleError: template error while templating string: no test named 'boolean'.

This happens because the template contains:

The boolean test was introduced in Jinja 2.11.0.
OK, good to know, but why am I creating this issue?
Well... your Galaxy metadata lists support for Enterprise Linux 8 (EL8):

- name: EL
versions:
- 8

And I have recently started using your role in an environment that uses (up-to-date) Red Hat Enterprise Linux 8. RHEL8 currently ships with Jinja2 2.10.1 in their supported repositories. This causes my Ansible to bail out with the mentioned error...

I have been able to resolve the issue by more or less recreating the boolean test in the template. I have supplied my solution to this issue via pull request: #2 . Please have a look. Yes it's not as pretty as the is boolean test, but it does work on RHEL8 production systems with Ansible 2.9.27 and the shipped python3-jinja2 from Red Hat for RHEL8.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.