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
- $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.
- $with_location_hook
    If set, will add the custom location hook to the config, note that it will not create the hook script.

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)
  • 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: '')
  • with_location_hook (Boolean) (defaults to: false)


29
30
31
32
33
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
# File 'modules/ceph/manifests/config.pp', line 29

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,
    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 = '',
    Boolean                     $with_location_hook = false,
) {

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

    # Ceph configuration file used for all services and clients
    file { '/etc/ceph/ceph.conf':
        ensure  => present,
        mode    => '0444',
        owner   => 'root',
        group   => '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,
        }),
        require => Package['ceph-common'],
    }

    if $enable_libvirt_rbd {

        if debian::codename::le('buster') {
            ensure_packages([
              'python-rbd',
            ])
        }

        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',
        }
    }
}