Skip to content

Latest commit

 

History

History
321 lines (213 loc) · 10.3 KB

REFERENCE.md

File metadata and controls

321 lines (213 loc) · 10.3 KB

Reference

Table of Contents

Classes

Public Classes

Private Classes

  • networkmanager::service: Ensure and restarts NetworkManager Service

Defined types

  • networkmanager::dns: Manages the DNS informations about a particular NetworkManager connection

Classes

networkmanager

Manages NetworkManager connections

Examples

using simple include
include networkmanager
using class
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,
      },
    },
}
using hieradata
---
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

The following parameters are available in the networkmanager class:

enable_global_dns

Data type: Boolean

By enabling this, NetworkManager will not use the connections specific dns settings. Instead it will generate a file with the desired dns settings. Those parameters are then the default, even if connection specific settings are present.

global_nameservers

Data type: Array[Stdlib::IP::Address::Nosubnet]

An array of the IP addresses for the nameservers for the global setting.

global_searchdomains

Data type: Array[String[1]]

An array of DNS search domains for the global setting.

global_dns_options

Data type: Optional[Variant[Array[String[1]], String]]

A string or an array of strings with resolving options for the global setting. If omitted, no global resolving optios are set.

global_conffile

Data type: Optional[Stdlib::Absolutepath]

The config file for global dns settings. Should be under /etc/NetworkManager/conf.d

manage_dns

Data type: Boolean

Whether we want to manage dns of the primary NetworkManager connection.

nameservers

Data type: Array[Stdlib::IP::Address::Nosubnet]

An array of the IP addresses of the resolvers to use for the primary NetworkManager connection. At least one address has to be given, but if exactly one address is given, a warning will be omitted.

dns_searchdomains

Data type: Array[String[1], 1]

An array of DNS search domains to use for the primary NetworkManager connection. At least one domain has to be given.

dns_options

Data type: Optional[Variant[Array[String[1]], String]]

A string or an array of strings with resolving options to use for the primary NetworkManager connection. Please note not to use whitespaces inside the strings, only use comma to separate options inside a string. If not given (or undef), the options are not managed. To remove existing options use an empty string '' as a value.

manage_service

Data type: Boolean

Whether we want to manage the NetworkManager service.

ensure_service

Data type: Optional[Variant[Boolean, String[1]]]

Whether a service should be running. Valid values are 'stopped', 'running', true, false.

service_name

Data type: String[1]

The systemd service name of NetworkManager, usually 'NetworkManager'.

enable_service

Data type: Boolean

Whether a service should be enabled to start at boot.

restart_service

Data type: Optional[String[1]]

Specify a restart command manually. If left unspecified, the service will be stopped and then started.

dns_notify_daemon

Data type: Boolean

A boolean flag, whether to notify the NetworkManager daemon after DNS changea on the primary NetworkManager connections. In case of a notification the NetworkManager daemon is rewriting /etc/resolv.conf immediately. In this way this resorce can be used to manage /etc/resolv.conf. CAUTION: If you are using another module for managing /etc/resolv.conf (like saz-resolv_conf), this option should be set to false to prevent a Ping-Pong game between those two modules. In this case manage_dns is only intended to ensure a correct /etc/resolv.conf immediately after a reboot.

Default value: true

connection_dnsoptions

Data type: Optional[Hash]

A hash for creating networkmanager::dns resources for managing DNS options on different NetworkManager connections. Be sure not to include the primary NetworkManager connection, if manage_dns is true.

Default value: undef

debug_output

Data type: Boolean

A flag to emit debug information during the puppet agent run

Default value: false

Defined types

networkmanager::dns

Manages the DNS informations about a particular NetworkManager connection

Examples

networkmanager::dns { 'System link':
    nameservers   => ['8.8.8.8', '8,.8.4.4', '1.1.1.1'],
    searchdomains => ['example.com', 'uhu-banane.de', 'uhu-banane.net'],
    dns_options   => ['timeout:1', 'attempts:2', 'use-vc'],
    notify_daemon => true,
}

Parameters

The following parameters are available in the networkmanager::dns defined type:

nameservers

Data type: Array[Stdlib::IP::Address::Nosubnet, 1]

An array of the IP addresses of the resolvers to use. At least one address has to be given, but if exactly one address is given, a warning will be omitted.

searchdomains

Data type: Array[String[1], 1]

An array of DNS search domains. At least one domain has to be given.

dns_options

Data type: Optional[Variant[Array[String[1]], String]]

A string or an array of strings with resolving options. Please note not to use whitespaces inside the strings, only use comma to separate options inside a string. If not given (or undef), the options are not managed. To remove existing options use an empty string '' as a value.

Default value: undef

connection

Data type: Optional[String[1]]

The name of the NetworkManager connection. If not given, the name of the resource will be used as the name of the connection.

Default value: undef

notify_daemon

Data type: Boolean

A boolean flag, whether to notify the NetworkManager daemon after DNS changes. In case of a notification the NetworkManager daemon is rewriting /etc/resolv.conf immediately. In this way this resorce can be used to manage /etc/resolv.conf. CAUTION: If you are using another module for managing /etc/resolv.conf (like saz-resolv_conf), this option should be set to false to prevent a Ping-Pong game between those two modules. In this case this resource is only intended to ensure a correct /etc/resolv.conf immediately after a reboot.

Default value: true

debug_output

Data type: Optional[Boolean]

A flag to emit debug information during the puppet agent run

Default value: undef