Puppet Class: etcd

Defined in:
manifests/init.pp

Summary

This module manages etcd (https://etcd.io) It uses a package-based install, and does not download binaries from a release page.

Overview

Parameters:

  • package_names (Array[String]) (defaults to: ['etcd'])

    A list of packages to install. Empty list will not install any packages. Default: [‘etcd’]

  • config (Variant[Hash, String]) (defaults to: { 'name' => $facts['networking']['fqdn'], 'data-dir' => '/var/lib/etcd', })

    Either a hash or a string containing etcd’s config. Hash will be converted to yaml, string will be expected to already be in yaml format and will be used as-is. Default: $facts[‘fqdn’], data-dir: ‘/var/lib/etcd’

  • config_dir (Stdlib::Unixpath) (defaults to: '/etc/etcd')

    Unixpath to the configuration directory Default: ‘/etc/etcd’

  • config_file (String) (defaults to: 'config.yaml')

    Filename of the configfile. Will be combined with $config_dir Default: ‘config.yaml’

  • manage_config_dir (Boolean) (defaults to: ($config_dir != '/etc')

    Wether to manage the config directory or not. Default: false if $config_dir is ‘/etc’ else true

  • purge_config_dir (Boolean) (defaults to: $manage_config_dir)

    Wether to purge the config directory or not. Default: same as $manage_config_dir

  • manage_service (Boolean) (defaults to: true)

    Wether to manage (run and enable) the service or not. Default: true

  • service_name (String) (defaults to: 'etcd')

    The name of the service Default: ‘etcd’

  • etcdctl_env (Hash[String, String]) (defaults to: {})

    Environment variables to use for etcdctl Also used for the custom providers Default: {}

    Example for etcd with auth and TLS enabled: “‘

    'ETCDCTL_INSECURE_TRANSPORT': 'false',
    'ETCDCTL_USER': 'root',
    'ETCDCTL_PASSWORD': 'Root123!',
    

    “‘

  • manage_etcdctl_profile (Boolean) (defaults to: true)

    Wether to manage /etc/profile.d/etcdctl.sh, containing the env vars from $etcdctl_env. Default: true

  • auth (Boolean) (defaults to: false)

    Enable/disable auth. Must add credentials to $etcdctl_env when enabled, to keep using types/providers. Default: false

  • roles (Hash[String, Hash]) (defaults to: {})

    ‘etcd_role` resources to create. Default: {}

  • purge_roles (Boolean) (defaults to: true)

    Wether to purge unmanaged roles or not Default: true

  • role_permissions (Hash[String, Hash]) (defaults to: {})

    ‘etcd_role_permission` resources to create. Default: {}

  • purge_role_permissions (Boolean) (defaults to: true)

    Wether to purge unmanaged role permissions or not Default: true

  • users (Hash[String, Hash]) (defaults to: {})

    ‘etcd_user` resources to create. Default: {}

  • purge_users (Boolean) (defaults to: true)

    Wether to purge unmanaged users or not Default: true

  • snapshot (Boolean) (defaults to: false)

    Add systemd timer to create snapshots in $snapshot_path Default: false

  • snapshot_path (Stdlib::Unixpath) (defaults to: '/var/lib/etcd/snapshot.db')

    The path to save snapshots to, if $snapshot is enabled Default: /var/lib/etcd/snapshot.db

  • snapshot_oncalendar (String) (defaults to: '*-*-* 00:00:00')

    The systemd OnCalendar timestamp to run snapshotting Default: --* 00:00:00



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

class etcd (
  Array[String]         $package_names          = ['etcd'],
  Variant[Hash, String] $config                 = {
    'name'     => $facts['networking']['fqdn'],
    'data-dir' => '/var/lib/etcd',
  }, # Set empty to not manage config
  Stdlib::Unixpath      $config_dir             = '/etc/etcd',
  String                $config_file            = 'config.yaml',
  Boolean               $manage_config_dir      = ($config_dir != '/etc'),
  Boolean               $purge_config_dir       = $manage_config_dir,
  Boolean               $manage_service         = true,
  String                $service_name           = 'etcd',
  Hash[String, String]  $etcdctl_env            = {},
  Boolean               $manage_etcdctl_profile = true,
  Boolean               $auth                   = false,
  Hash[String, Hash]    $roles                  = {},
  Boolean               $purge_roles            = true,
  Hash[String, Hash]    $role_permissions       = {},
  Boolean               $purge_role_permissions = true,
  Hash[String, Hash]    $users                  = {},
  Boolean               $purge_users            = true,
  Boolean               $snapshot               = false,
  Stdlib::Unixpath      $snapshot_path          = '/var/lib/etcd/snapshot.db',
  String                $snapshot_oncalendar    = '*-*-* 00:00:00',
) {
  contain etcd::install
  contain etcd::config
  contain etcd::service
  contain etcd::auth
  contain etcd::snapshot

  Class['etcd::install']
  -> Class['etcd::config']
  -> Class['etcd::service']
  -> Class['etcd::auth']
  -> Class['etcd::snapshot']
}