Git Product home page Git Product logo

puppet-networkmanager's Introduction

networkmanager

Table of Contents

Description

Get and set parameters of NetworkManager controlled connections.

In the first iteration this module supports management of two aspects of the NetworkManager:

  • Management of the NetworkManager daemon - whther it is running and enabled or not
  • Management of DNS information of particular NetworkManager connections. This could be done on three different ways:
    • Either by configurig a global Configuration file below /etc/NetworkManager/conf.d,
    • or by setting the DNS parameters of the primary NetworkManager connection (whichever it is),
    • or by setting the DNS parameters of one or more named NetworkManager connections.

Setup

Setup Requirements

This module requires following:

  • Puppet >= 6.0
  • the module puppetlabs-stdlib >= 7.0.0

This module ist supported only for operating systems using NetworkManager. If the NetworkManager command line tool nmcli could not be found, the module fails immediately.

This module was currently tested on:

  • CentOS-7 and CentOS-8
  • Oracle Enterprise Linux 7

Usage

Simple Including the module

The following two examples are simply including the networkmanager module. The further configuration must be done via hieradata.

include networkmanager

or

contain networkmanager

Instantiation as a class

The following example is instatiating this module class with nearly all parameters:

class {'networkmanager':
    enable_global_dns     => false,
    manage_dns            => true,
    nameservers           => ['8.8.8.8', '8.8.4.4', '1.1.1.1'].
    dns_searchdomains     => ['example.com', 'uhu-banane.de', 'uhu-banane.net'],
    dns_options           => ['timeout:1', 'attempts:2', 'use-vc'],
    manage_service        => true.
    ensure_service        => running,
    enable_service        => true,
    dns_notify_daemon     => false,
    connection_dnsoptions => {
      wifi1               => {
        nameservers       => ['172.28.1.2', '172.30.1.2'],
        searchdomains     => ['home.example.com'],
        dns_options       => ['timeout:3, 'attempts:3', 'use-vc'],
        notify_daemon     => true,
      },
    },
}

Setup of hieradata

All parameters of the networkmanager module could be configured as hieradata. But be aware, that all parameters are looked up with a first lookup. If you want to make a deep lookup, yu have to set the lookup options by yourself.

---
networkmanager::enable_global_dns: false
networkmanager::manage_dns: true
networkmanager::nameservers:
  - '8.8.8.8'
  - '8.8.4.4'
  - '1.1.1.1'
networkmanager::dns_searchdomains:
  - 'example.com'
  - 'uhu-banane.de'
  - 'uhu-banane.net'
networkmanager::dns_options:
  - 'timeout:1'
  - 'attempts:2'
  - 'use-vc'
networkmanager::manage_service: true
networkmanager::ensure_service: running
networkmanager::enable_service: true
networkmanager::dns_notify_daemon: false
networkmanager::connection_dnsoptions:
  wifi1:
    nameservers:
      - '172.28.1.2'
      - '172.30.1.2'
    searchdomains:
      - 'home.example.com'
    dns_options:
      - 'timeout:3'
      - 'attempts:3'
      - 'use-vc'
    notify_daemon: true

Parameters

Limitations

The development of this module has even started, so the amount on functionality is not so giant.

Don't hasitate to bring here new ideas, how to improve this module.

Development

In the Development section, tell other users the ground rules for contributing to your project and how they should submit their work.

puppet-networkmanager's People

Contributors

bastelfreak avatar cruelsmith avatar fbrehm avatar rwaffen avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

puppet-networkmanager's Issues

Empty networkmanager_dns for connection names with whitespaces

Describe the bug
The facts networkmanager_dns does not return the networkmanager connection settings for connections with names that incl. whitespaces:

> facter -p networkmanager_connections
[
  "System ether0"
]

> facter -p networkmanager_dns
{
  System ether0 => {
    nameserver => [

    ],
    options => [

    ],
    search => [

    ]
  }
}

> nmcli -g ipv4.dns connection show id System ether0
Fehler: Verbindungsprofil System existiert nicht.

> nmcli -g ipv4.dns connection show id "System ether0"
8.8.8.8,8.8.4.4

To Reproduce
Rename a networkmanager connection to a name that incl. a whitespace.

Expected behavior
Fact returns the right settings.

Additional context

dns[connection][:nameserver] = Facter::Core::Execution.execute("#{nmcli} -g ipv4.dns connection show id #{connection}").split(',')
dns[connection][:search] = Facter::Core::Execution.execute("#{nmcli} -g ipv4.dns-search connection show id #{connection}").split(',')
dns[connection][:options] = Facter::Core::Execution.execute("#{nmcli} -e no -g ipv4.dns-options connection show id #{connection}").split(',')

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.