mds.pp 3.19 KB
Newer Older
1
#   Copyright (C) 2013, 2014 iWeb Technologies Inc.
2 3 4 5 6 7 8 9 10 11 12 13 14 15
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.
#
# Author: David Moreau Simard <dmsimard@iweb.com>
16 17 18
#
# == Class: ceph::mds
#
19
# Installs and configures MDSs (ceph metadata servers)
20 21 22
#
# === Parameters:
#
23 24 25 26 27 28 29 30 31
# [*public_addr*] The bind IP address.
#   Optional. The IPv(4|6) address on which MDS binds itself.
#
# [*pkg_mds*] Package name for the MDS service.
#   Optional. Defaults to the value of ceph::params::pkg_mds
#
# [*pkg_mds_ensure*] Ensure status for the pkg_mds package resources
#   Optional. Defaults to present.
#
32
# [*mds_activate*] Switch to activate the '[mds]' section in the config.
33
#   Optional. Defaults to true.
34 35
#
# [*mds_data*] The path to the MDS data.
36 37 38 39 40 41 42 43 44 45
#   Optional. Same default as ceph.
#
# [*mds_enable*] Whether to enable ceph-mds instance on boot.
#   Optional. Default is true.
#
# [*mds_ensure*] Whether to start the MDS service.
#   Optional. Default is running.
#
# [*mds_id*] The ID of the MDS instance.
#   Optional. Default is $::hostname
46 47
#
# [*keyring*] The location of the keyring used by MDSs
48 49 50 51
#   Optional. Same default as ceph.
#
# [*cluster*] The ceph cluster
#   Optional. Default to 'ceph'.
52
#
53
class ceph::mds (
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
  $public_addr    = undef,
  $pkg_mds        = $::ceph::params::pkg_mds,
  $pkg_mds_ensure = present,
  $mds_activate   = true,
  $mds_data       = undef,
  $mds_enable     = true,
  $mds_ensure     = 'running',
  $mds_id         = $::hostname,
  $keyring        = undef,
  $cluster        = 'ceph',
) inherits ceph::params {
  if $mds_data {
    $mds_data_real = $mds_data
  } else {
    $mds_data_real = "/var/lib/ceph/mds/${cluster}-${mds_id}"
  }

  if $keyring {
    $keyring_real = $keyring
  } else {
    $keyring_real = "${mds_data_real}/keyring"
  }

  Ceph_config<||> ~> Service<| tag == 'ceph-mds' |>
  Package<| tag == 'ceph' |>
  -> File[$mds_data_real]
  -> Service<| tag == 'ceph-mds' |>

  $mds_service_name = "ceph-mds@${mds_id}"

  service { $mds_service_name:
    ensure => $mds_ensure,
    enable => $mds_enable,
    tag    => ['ceph-mds']
  }

  package { $pkg_mds:
    ensure => $pkg_mds_ensure,
    tag    => 'ceph',
  }

  file { $mds_data_real:
    ensure                  => directory,
    owner                   => 'ceph',
    group                   => 'ceph',
    mode                    => '0750',
    selinux_ignore_defaults => true,
  }
102

103 104
  if $mds_activate {
    ceph_config {
105 106 107 108 109 110 111
      'mds/mds_data': value => $mds_data_real;
      'mds/keyring':  value => $keyring_real;
    }
    if $public_addr {
      ceph_config {
        "mds.${mds_id}/public_addr": value => $public_addr;
      }
112
    }
113 114 115 116 117 118
  } else {
    ceph_config {
      'mds/mds_data': ensure => absent;
      'mds/keyring':  ensure => absent;
    }
  }
119
}