Puppet Class: conman

Defined in:
manifests/init.pp

Summary

Manage conman

Overview

Examples:

include ::conman

Parameters:

  • server (Boolean) (defaults to: true)

    Boolean that sets host to act as conman server

  • ensure (Enum['present', 'absent']) (defaults to: 'present')

    Module ensure property

  • conman_server (Stdlib::Host) (defaults to: $facts['networking']['fqdn'])

    Hostname of conman server

  • conman_port (Stdlib::Port) (defaults to: 7890)

    The port for conman server

  • cfgfile (String) (defaults to: '/etc/conman.conf')

    The conman configuration file

  • consoles (Hash) (defaults to: {})

    Hash of conman::console resources

  • manage_repo (Boolean) (defaults to: true)

    Manage repo to install conman, only used on EL8

  • coredump (Boolean) (defaults to: false)

    See conman.conf man page

  • coredumpdir (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    See conman.conf man page

  • execpath (Optional[String]) (defaults to: undef)

    See conman.conf man page

  • keepalive (Boolean) (defaults to: true)

    See conman.conf man page

  • logdir (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    See conman.conf man page

  • logfile (Optional[String]) (defaults to: undef)

    See conman.conf man page

  • loopback (Boolean) (defaults to: false)

    See conman.conf man page

  • pidfile (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    See conman.conf man page

  • resetcmd (Optional[String]) (defaults to: undef)

    See conman.conf man page

  • syslog (Optional[String]) (defaults to: undef)

    See conman.conf man page

  • tcpwrappers (Optional[Boolean]) (defaults to: undef)

    See conman.conf man page

  • timestamp (String) (defaults to: '0')

    See conman.conf man page

  • log (Optional[String]) (defaults to: undef)

    See conman.conf man page

  • logopts (Optional[String]) (defaults to: undef)

    See conman.conf man page

  • seropts (String) (defaults to: '9600,8n1')

    See conman.conf man page

  • ipmiopts (Optional[String]) (defaults to: undef)

    See conman.conf man page



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'manifests/init.pp', line 52

class conman (
  Boolean $server = true,
  Enum['present', 'absent'] $ensure = 'present',
  Stdlib::Host $conman_server = $facts['networking']['fqdn'],
  Stdlib::Port $conman_port = 7890,
  String $cfgfile = '/etc/conman.conf',
  Hash $consoles = {},
  Boolean $manage_repo = true,
  # server config
  Boolean $coredump = false,
  Optional[Stdlib::Absolutepath] $coredumpdir = undef,
  Optional[String] $execpath = undef,
  Boolean $keepalive = true,
  Optional[Stdlib::Absolutepath] $logdir = undef,
  Optional[String] $logfile = undef,
  Boolean $loopback = false,
  Optional[Stdlib::Absolutepath] $pidfile = undef,
  Optional[String] $resetcmd = undef,
  Optional[String] $syslog = undef,
  Optional[Boolean] $tcpwrappers = undef,
  String $timestamp = '0',
  # global config
  Optional[String] $log = undef,
  Optional[String] $logopts = undef,
  String $seropts = '9600,8n1',
  Optional[String] $ipmiopts = undef,
) {

  if $ensure == 'present' {
    $package_ensure = 'present'
    $cfg_ensure     = 'present'
    if $server {
      $env_ensure     = 'absent'
      $service_ensure = 'running'
      $service_enable = true
    } else {
      $env_ensure     = 'file'
      $service_ensure = 'stopped'
      $service_enable = false
    }
  } else {
    $package_ensure = 'absent'
    $cfg_ensure     = 'absent'
    $env_ensure     = 'absent'
    $service_ensure = 'stopped'
    $service_enable = false
  }

  if $manage_repo and $facts['os']['family'] == 'RedHat' and versioncmp($facts['os']['release']['major'], '8') >= 0 {
    include epel
    Class['epel'] -> Package['conman']
  }

  package { 'conman':
    ensure => $package_ensure,
  }

  if $server or $ensure == 'absent' {
    concat { $cfgfile:
      ensure    => $cfg_ensure,
      owner     => 'root',
      group     => 'root',
      mode      => '0640',
      show_diff => false,
      require   => Package['conman'],
      notify    => Service['conman'],
    }
  }
  if $server and $ensure == 'present' {
    concat::fragment { 'conman.conf.header':
      target  => $cfgfile,
      content => template('conman/etc/conman.conf.header.erb'),
      order   => '01',
    }
    $consoles.each |$console_name, $console| {
      conman::console { $console_name:
        * => $console,
      }
    }
  }

  service { 'conman':
    ensure     => $service_ensure,
    enable     => $service_enable,
    hasrestart => true,
    hasstatus  => true,
  }

  file { '/etc/profile.d/conman.sh':
    ensure  => $env_ensure,
    content => template('conman/etc/profile.d/conman.sh.erb'),
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
  }
  file { '/etc/profile.d/conman.csh':
    ensure  => $env_ensure,
    content => template('conman/etc/profile.d/conman.csh.erb'),
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
  }
}