Puppet Class: psick

Defined in:
manifests/init.pp

Overview

The main psick class. From here the whole infrastructure can be built. This class exposes parameters that serve as entry points to set general settings used by other psick profiles. When included, this class does nothing by default, but it’s required to be able to use PSICK for classification and/or to use any PSICK profile.

Examples:

Sample data for proxy server hash

psick::servers:
  proxy:
    host: proxy.example.com
    port: 3128
    user: john    # Optional
    password: xxx # Optional
    no_proxy:
      - localhost
      - "%{::domain}"
    scheme: http

Parameters:

  • manage (Boolean) (defaults to: true)

    If to actually manage the resources of a class. This allows to skip management of resources even if classes are included. Used to avoid to manage some resources when building Docker images.

  • auto_prereq (Boolean) (defaults to: true)

    If to automtically manage prerequisites. Set to false here to apply this value for all the PSICK profiles that honour this global setting. Use when you have duplicated resources.

  • auto_conf (Psick::Autoconf) (defaults to: 'none')

    Which autoconfiguration layout to use. Default is ‘none’, if you set ‘hardened’ some hardened configurations are enforced by default

  • enable_firstrun (Boolean) (defaults to: false)

    If to enable firstrun mode, a special one-time only, Puppet run where some specific, prerequisites, classes are applied.

  • noop_mode (Boolean) (defaults to: lookup('noop_mode', Boolean,'first',true))

    Psick’s noop mode. Looks for the hiera key noop_mode to check if to enable noop mode in the module itself. The same is done on the default psick-control repo. Note that if noop_mode is set to true here (or in Hiera’s noop_mode key) the no-noop params in the psick profiles are not valid: If noop_mode is true, noop is enforced also where no-noop is true.

  • is_cluster (Boolean) (defaults to: false)

    Defines if the server is a cluster member. Some PSICK profiles may use this value.

  • primary_ip (Optional[Stdlib::Compat::Ip_address]) (defaults to: fact('networking.ip'))

    The server primary IP address. Default value is the value of the $::networking fact.

  • mgmt_interface (Optional[String]) (defaults to: fact('networking.primary'))

    The management interface of the server. Default value is the value of the $::networking fact.

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

    The timezone to set on the system. Single entry point used by some PSICK profiles.

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

    An hash of custom settings which can be used to configure any settings which might be used in different profiles. This is not used in any existing PSICK profiles, but can be referenced in any custom profile classified via PSICK.

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

    An hash which describes general infrastructure endpoints which can be used by different (PSICK or local) profiles. Used in psick::proxy and whenever it might be needed to refer to a single endpoint used by differenet classes / profiles.

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

    An hash to configure behaviour of tp defines. It’s used to set resource defaults for tp::install, tp::conf and tp::dir.

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

    An hash of general firewall settings. Can be used and honoured by other psick profiles. Customise as needed.

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

    An hash of general monitor settings. Can be used and honoured by other psick profiles. Customise as needed.

  • force_ordering (Boolean) (defaults to: true)

    When enabled, as default, the psick module enforces ordering of the classes included in psick::pre -> psick::base -> psick::profiles. Disable only if you have unresolvable dependency loops or if you don’t want the PSICK class provisioning staged in different phases.

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


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
# File 'manifests/init.pp', line 63

class psick (

  # PSICK global vars
  Boolean $manage                                  = true,
  Boolean $auto_prereq                             = true,
  Psick::Autoconf $auto_conf                       = 'none',
  Boolean $enable_firstrun                         = false,
  Boolean $noop_mode                               = lookup('noop_mode', Boolean,'first',true),

  # General network settings
  Boolean $is_cluster = false,
  Optional[Stdlib::Compat::Ip_address] $primary_ip = fact('networking.ip'),
  Optional[String] $mgmt_interface                 = fact('networking.primary'),
  Optional[String] $timezone                       = undef,
  Hash $interfaces_hash                            = {},

  # General endpoints and variables
  Hash $settings                                   = {},
  Hash $servers                                    = {},
  Hash $tp                                         = {},
  Hash $firewall                                   = {},
  Hash $monitor                                    = {},
  Boolean $force_ordering                          = true,

) {

  # Resource defaults for Tiny Puppet defines
  Tp::Install {
    cli_enable   => $tp['cli_enable'],
    test_enable  => $tp['test_enable'],
    puppi_enable => $tp['puppi_enable'],
    debug        => $tp['debug'],
    data_module  => $tp['data_module'],
  }
  Tp::Conf {
    config_file_notify  => $tp['config_file_notify'],
    config_file_require => $tp['config_file_require'],
    debug               => $tp['debug'],
    data_module         => $tp['data_module'],
  }
  Tp::Dir {
    config_dir_notify  => $tp['config_dir_notify'],
    config_dir_require => $tp['config_dir_require'],
    debug              => $tp['debug'],
    data_module        => $tp['data_module'],
  }

  # Building of the $::psick::interfaces variable, usable in any class included
  # via or after psick.
  # By default are set main and mgmt interfaces based on sane facts values and
  # user params $primary_ip and $mgmt_interface
  $primary_interface =  $facts['networking']['primary']
  $interfaces_default = {
    main => {
      interface => $facts['networking']['primary'],
      address   => pick($primary_ip, $facts['networking']['interfaces'][$primary_interface]['ip']),
      netmask   => $facts['networking']['interfaces'][$primary_interface]['netmask'],
      network   => $facts['networking']['interfaces'][$primary_interface]['network'],
      hostname  => $facts['networking']['fqdn'],
    },
    mgmt => {
      interface => $mgmt_interface,
      address   => $facts['networking']['interfaces'][$mgmt_interface]['ip'],
      netmask   => $facts['networking']['interfaces'][$mgmt_interface]['netmask'],
      network   => $facts['networking']['interfaces'][$mgmt_interface]['network'],
      hostname  => $facts['networking']['fqdn'],
    }
  }
  $interfaces = deep_merge($interfaces_default, $interfaces_hash)


  # PSICK PRE, BASE CLASSES AND PROFILES + OPTIONAL FIRSTRUN MODE
  # The classes included here manage PSICK classification and
  # relevant class ordering
  if $facts['firstrun'] == 'done' or $enable_firstrun == false {
    contain ::psick::pre
    contain ::psick::base
    contain ::psick::profiles
    if $force_ordering {
      Class['psick::pre'] -> Class['psick::base'] -> Class['psick::profiles']
    }
  } else {
    contain ::psick::firstrun
    notify { "This catalog should be applied only at the first Puppen run\n": }
  }

}