Puppet Class: gnmic

Defined in:
modules/gnmic/manifests/init.pp

Overview

Parameters:

  • outputs (Hash[String, Hash])
  • password (String)
  • processors (Hash[String, Hash])
  • targets (Hash[String, Hash])
  • username (String)
  • subscriptions (Hash[String, Hash])
  • tls_ca (Stdlib::Unixpath) (defaults to: $facts['puppet_config']['localcacert'])


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'modules/gnmic/manifests/init.pp', line 10

class gnmic(
    Hash[String, Hash] $outputs,
    String             $password,
    Hash[String, Hash] $processors,
    Hash[String, Hash] $targets,
    String             $username,
    Hash[String, Hash] $subscriptions,
    Stdlib::Unixpath   $tls_ca = $facts['puppet_config']['localcacert']
  ){
    ensure_packages(['gnmic'])

    systemd::sysuser { 'gnmic':
        description => 'gNMIc user'
    }

    $config = wmflib::resource::filter_params('tls_ca') + {
        'tls-ca' => $tls_ca,
    }

    # No need for notify as gnmic watches the config file
    file { '/etc/gnmic.yaml':
        ensure  => file,
        mode    => '0400',  # contains password
        owner   => 'gnmic',
        group   => 'gnmic',
        content => $config.to_yaml,
    }

    systemd::service { 'gnmic':
        content => template('gnmic/gnmic.service.erb'),
        require => Package['gnmic'],
        restart => true
    }

    profile::auto_restarts::service { 'gnmic': }
}