From 44a22fc61e24c2efc221edd7085c8f4d44b39fc0 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Sun, 1 Feb 2015 18:52:18 -0500 Subject: Puppet: First support Ceph This is a first implementation of Ceph support in TripleO with Puppet: * Install ceph-mon on controller node * Install ceph-osd on cephstorage node Co-Authored-By: Giulio Fidente Change-Id: I48488cbe950047fae5e746e458106d6edb9a6183 --- puppet/ceph-cluster-config.yaml | 48 +++++++++++++++++ puppet/ceph-storage-post-puppet.yaml | 24 +++++++++ puppet/ceph-storage-puppet.yaml | 88 ++++++++++++++++++++++++++++++- puppet/controller-puppet.yaml | 4 ++ puppet/hieradata/ceph.yaml | 7 +++ puppet/manifests/overcloud_cephstorage.pp | 35 ++++++++++++ puppet/manifests/overcloud_controller.pp | 8 +++ 7 files changed, 213 insertions(+), 1 deletion(-) create mode 100644 puppet/ceph-cluster-config.yaml create mode 100644 puppet/ceph-storage-post-puppet.yaml create mode 100644 puppet/hieradata/ceph.yaml create mode 100644 puppet/manifests/overcloud_cephstorage.pp (limited to 'puppet') diff --git a/puppet/ceph-cluster-config.yaml b/puppet/ceph-cluster-config.yaml new file mode 100644 index 00000000..dab029f3 --- /dev/null +++ b/puppet/ceph-cluster-config.yaml @@ -0,0 +1,48 @@ +heat_template_version: 2014-10-16 +description: 'Ceph Cluster config data for Puppet' + +parameters: + ceph_fsid: + default: '' + type: string + ceph_admin_key: + default: '' + type: string + ceph_mon_key: + default: '' + type: string + ceph_mon_names: + type: comma_delimited_list + ceph_mon_ips: + type: comma_delimited_list + +resources: + CephClusterConfigImpl: + type: OS::Heat::StructuredConfig + properties: + group: os-apply-config + config: + hiera: + datafiles: + ceph_cluster: + mapped_data: + ceph_mon_initial_members: + list_join: + - ',' + - {get_param: ceph_mon_names} + ceph::profile::params::mon_host: + list_join: + - ',' + - {get_param: ceph_mon_ips} + ceph::profile::params::fsid: {get_param: ceph_fsid} + ceph::profile::params::admin_key: {get_param: ceph_admin_key} + ceph::profile::params::mon_key: {get_param: ceph_mon_key} + # We would need a dedicated key for OSD + ceph::profile::params::bootstrap_osd_key: {get_param: ceph_mon_key} + ceph::profile::params::osds: '{"/srv/data": {}}' + +outputs: + config_id: + description: The ID of the CephClusterConfigImpl resource. + value: + {get_resource: CephClusterConfigImpl} diff --git a/puppet/ceph-storage-post-puppet.yaml b/puppet/ceph-storage-post-puppet.yaml new file mode 100644 index 00000000..dd01d4fd --- /dev/null +++ b/puppet/ceph-storage-post-puppet.yaml @@ -0,0 +1,24 @@ +heat_template_version: 2014-10-16 + +description: > + OpenStack Ceph Storage node post deployment for Puppet. + +parameters: + servers: + type: json + +resources: + CephStoragePuppetConfig: + type: OS::Heat::SoftwareConfig + properties: + group: puppet + outputs: + - name: result + config: + get_file: manifests/overcloud_cephstorage.pp + + CephStoragePuppetDeployment: + type: OS::Heat::StructuredDeployments + properties: + servers: {get_param: servers} + config: {get_resource: CephStoragePuppetConfig} diff --git a/puppet/ceph-storage-puppet.yaml b/puppet/ceph-storage-puppet.yaml index c9aa7bcf..4a78da80 100644 --- a/puppet/ceph-storage-puppet.yaml +++ b/puppet/ceph-storage-puppet.yaml @@ -1,2 +1,88 @@ heat_template_version: 2014-10-16 -description: 'Common Ceph Storage Configuration by Puppet' +description: 'Common Ceph Storage Configuration for Puppet' +parameters: + Flavor: + description: Flavor for the Ceph Storage node. + type: string + constraints: + - custom_constraint: nova.flavor + Image: + type: string + default: overcloud-ceph-storage + constraints: + - custom_constraint: glance.image + ImageUpdatePolicy: + default: 'REBUILD_PRESERVE_EPHEMERAL' + description: What policy to use when reconstructing instances. REBUILD for rebuilds, REBUILD_PRESERVE_EPHEMERAL to preserve /mnt. + type: string + KeyName: + description: Name of an existing EC2 KeyPair to enable SSH access to the instances + type: string + default: default + constraints: + - custom_constraint: nova.keypair + NtpServer: + type: string + default: '' + EnablePackageInstall: + default: 'false' + description: Set to true to enable package installation via Puppet + type: boolean + +resources: + CephStorage: + type: OS::Nova::Server + properties: + image: {get_param: Image} + image_update_policy: {get_param: ImageUpdatePolicy} + flavor: {get_param: Flavor} + key_name: {get_param: KeyName} + networks: + - network: ctlplane + user_data_format: SOFTWARE_CONFIG + CephStorageDeployment: + type: OS::Heat::StructuredDeployment + properties: + config: {get_resource: CephStorageConfig} + server: {get_resource: CephStorage} + input_values: + ntp_servers: + str_replace: + template: '["server"]' + params: + server: {get_param: NtpServer} + enable_package_install: {get_param: EnablePackageInstall} + CephStorageConfig: + type: OS::Heat::StructuredConfig + properties: + group: os-apply-config + config: + hiera: + hierarchy: + - heat_config_%{::deploy_config_name} + - cephstorage + - ceph_cluster # provided by CephClusterConfig + - ceph + - common + datafiles: + common: + raw_data: {get_file: hieradata/common.yaml} + ceph: + raw_data: {get_file: hieradata/ceph.yaml} + cephstorage: + mapped_data: + ntp::servers: {get_input: ntp_servers} + enable_package_install: {get_input: enable_package_install} + +outputs: + hosts_entry: + value: + str_replace: + template: "IP HOST HOST.novalocal" + params: + IP: {get_attr: [CephStorage, networks, ctlplane, 0]} + HOST: {get_attr: [CephStorage, name]} + nova_server_resource: + description: Heat resource handle for the ceph storage server + value: + {get_resource: CephStorage} diff --git a/puppet/controller-puppet.yaml b/puppet/controller-puppet.yaml index e24a6666..18c585d7 100644 --- a/puppet/controller-puppet.yaml +++ b/puppet/controller-puppet.yaml @@ -556,11 +556,15 @@ resources: - object - swift_devices_and_proxy # provided by SwiftDevicesAndProxyConfig - rabbit # provided by allNodesConfig + - ceph_cluster # provided by CephClusterConfig + - ceph - bootstrap_node # provided by BootstrapNodeConfig - common datafiles: common: raw_data: {get_file: hieradata/common.yaml} + ceph: + raw_data: {get_file: hieradata/ceph.yaml} object: raw_data: {get_file: hieradata/object.yaml} controller: diff --git a/puppet/hieradata/ceph.yaml b/puppet/hieradata/ceph.yaml new file mode 100644 index 00000000..995de2cf --- /dev/null +++ b/puppet/hieradata/ceph.yaml @@ -0,0 +1,7 @@ +ceph::profile::params::osd_journal_size: 1024 +ceph::profile::params::osd_pool_default_pg_num: 128 +ceph::profile::params::osd_pool_default_pgp_num: 128 +ceph::profile::params::osd_pool_default_size: 3 +ceph::profile::params::osd_pool_default_min_size: 1 +ceph::profile::params::manage_repo: false +ceph::profile::params::authentication_type: cephx diff --git a/puppet/manifests/overcloud_cephstorage.pp b/puppet/manifests/overcloud_cephstorage.pp new file mode 100644 index 00000000..c0f19e23 --- /dev/null +++ b/puppet/manifests/overcloud_cephstorage.pp @@ -0,0 +1,35 @@ +# Copyright 2015 Red Hat, Inc. +# All Rights Reserved. +# +# 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. + +if !str2bool(hiera('enable_package_install', 'false')) { + case $::osfamily { + 'RedHat': { + Package { provider => 'norpm' } # provided by tripleo-puppet + } + default: { + warning('enable_package_install option not supported.') + } + } +} + +if count(hiera('ntp::servers')) > 0 { + include ::ntp +} + +class { 'ceph::profile::params': + mon_initial_members => downcase(hiera('ceph_mon_initial_members')) +} +include ::ceph::profile::client +include ::ceph::profile::osd \ No newline at end of file diff --git a/puppet/manifests/overcloud_controller.pp b/puppet/manifests/overcloud_controller.pp index 2e83b8c3..23e8adf0 100644 --- a/puppet/manifests/overcloud_controller.pp +++ b/puppet/manifests/overcloud_controller.pp @@ -150,6 +150,14 @@ if hiera('step') >= 1 { # pre-install swift here so we can build rings include ::swift + # don't install Ceph if FSID is not provided + if hiera('ceph::profile::params::fsid', false) { + class { 'ceph::profile::params': + mon_initial_members => downcase(hiera('ceph_mon_initial_members')) + } + include ::ceph::profile::mon + } + } #END STEP 1 if hiera('step') >= 2 { -- cgit 1.2.3-korg