Puppet Class: ceph::config

Defined in:
modules/ceph/manifests/config.pp

Overview

Class: ceph::config

This class manages the Ceph common packages and configuration

Parameters

  • $mon_hosts Hash that defines the ceph monitor host's public and private IPv4 information
  • $fsid Ceph filesystem ID
  • $enable_v2_messenger Enables Ceph messenger version 2 ( >= Nautilus release)
  • $enable_libvirt_rbd Configure Ceph for libvirt based RBD clients
  • $with_location_hook If set, will add the custom location hook to the config, note that it will not create the hook script.
  • $force_secure_ms_client_mode If set, forces ms_client_mode = secure in the [global] block; only used by client profiles.
  • $osd_hosts [Optional] Hash that defines the ceph object storage hosts, and public and private IPv4 information
  • $radosgw_port [Optional] Listen port for the rados gateway. Gateway will only be configured if this is set.
  • $keystone_internal_uri [Optional] URI for internal keystone service. Only used if radosgw_port is set.
  • $radosgw_service_user [Optional] Name of radosgw service user (probably 'swift'). Only used if radosgw_port is set.
  • $radosgw_service_user_project [Optional] Project for radosgw service user (probably 'service'). Only used if radosgw_port is set.
  • $radosgw_service_user_password [Optional] Password for radosgw service user. Only used if radosgw_port is set.
  • $rgw_sts_key [Optional] Key for STS session tokens, from 'ceph-authtool --gen-print-key' (19.2.6 and later) or 16 hex characters (earlier releases). If set, enables STS on the rados gateway and makes ceph.conf readable only by root and the ceph group. Only used if radosgw_port is set.

Parameters:

  • enable_libvirt_rbd (Boolean)
  • enable_v2_messenger (Boolean)
  • mon_hosts (Hash[String,Hash])
  • cluster_networks (Array[Stdlib::IP::Address])
  • public_networks (Array[Stdlib::IP::Address])
  • fsid (String)
  • with_location_hook (Boolean) (defaults to: false)
  • force_secure_ms_client_mode (Boolean) (defaults to: false)
  • osd_hosts (Optional[Hash[String,Hash]]) (defaults to: {})
  • radosgw_port (Optional[Stdlib::Port]) (defaults to: 0)
  • keystone_internal_uri (Optional[String]) (defaults to: '')
  • radosgw_service_user (Optional[String]) (defaults to: '')
  • radosgw_service_user_project (Optional[String]) (defaults to: '')
  • radosgw_service_user_pass (Optional[String]) (defaults to: '')
  • enable_qos (Optional[Boolean]) (defaults to: false)
  • slow_ops_threshold (Optional[Integer]) (defaults to: 1)
  • slow_ops_window_seconds (Optional[Integer]) (defaults to: 86400)
  • rgw_sts_key (Optional[Pattern[/\A[A-Za-z0-9+\/=]{16,}\z/]]) (defaults to: undef)


34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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
# File 'modules/ceph/manifests/config.pp', line 34

class ceph::config (
    Boolean                     $enable_libvirt_rbd,
    Boolean                     $enable_v2_messenger,
    Hash[String,Hash]           $mon_hosts,
    Array[Stdlib::IP::Address]  $cluster_networks,
    Array[Stdlib::IP::Address]  $public_networks,
    String                      $fsid,
    Boolean                     $with_location_hook = false,
    Boolean                     $force_secure_ms_client_mode = false,
    Optional[Hash[String,Hash]] $osd_hosts = {},
    Optional[Stdlib::Port]      $radosgw_port = 0,
    Optional[String]            $keystone_internal_uri = '',
    Optional[String]            $radosgw_service_user = '',
    Optional[String]            $radosgw_service_user_project = '',
    Optional[String]            $radosgw_service_user_pass = '',
    Optional[Boolean]           $enable_qos = false,
    Optional[Integer]           $slow_ops_threshold = 1,
    Optional[Integer]           $slow_ops_window_seconds = 86400,
    Optional[Pattern[/\A[A-Za-z0-9+\/=]{16,}\z/]] $rgw_sts_key = undef,
) {

    Class['ceph::common'] -> Class['ceph::config']

    # Do not make the file world-readable if it contains the STS key.
    $conf_has_secret = $rgw_sts_key and $radosgw_port != 0

    # Ceph configuration file used for all services and clients
    file { '/etc/ceph/ceph.conf':
        ensure  => present,
        mode    => $conf_has_secret.bool2str('0440', '0444'),
        owner   => 'root',
        group   => $conf_has_secret.bool2str('ceph', 'root'),
        content => epp('ceph/ceph.conf.epp', {
            enable_libvirt_rbd                 => $enable_libvirt_rbd,
            enable_v2_messenger                => $enable_v2_messenger,
            mon_hosts                          => $mon_hosts,
            cluster_networks                   => $cluster_networks,
            public_networks                    => $public_networks,
            fsid                               => $fsid,
            osd_hosts                          => $osd_hosts,
            radosgw_port                       => $radosgw_port,
            keystone_internal_uri              => $keystone_internal_uri,
            radosgw_service_user               => $radosgw_service_user,
            radosgw_service_user_project       => $radosgw_service_user_project,
            radosgw_service_user_pass          => $radosgw_service_user_pass,
            with_location_hook                 => $with_location_hook,
            osd_heartbeat_use_min_delay_socket => $enable_qos,
            force_secure_ms_client_mode        => $force_secure_ms_client_mode,
            slow_ops_threshold                 => $slow_ops_threshold,
            slow_ops_window_seconds            => $slow_ops_window_seconds,
            rgw_sts_key                        => $rgw_sts_key,
        }),
        require => Package['ceph-common'],
    }

    if $enable_libvirt_rbd {
        stdlib::ensure_packages([
          # Enable rbd support in qemu
          'qemu-block-extra',
        ])

        # This directory contains qemu guest logs
        file { '/var/log/ceph/qemu':
            ensure => directory,
            mode   => '0755',
            owner  => 'libvirt-qemu',
            group  => 'libvirt-qemu',
        }

        # Allow libvirt-qemu to access the Ceph admin socket
        File<|title == '/var/run/ceph'|> {
            group  => 'libvirt-qemu',
        }

        file { '/var/run/ceph/guests':
            ensure => directory,
            mode   => '0770',
            owner  => 'ceph',
            group  => 'libvirt-qemu',
        }
    }
}