Configure CephStorage services via resource chains
authorGiulio Fidente <gfidente@redhat.com>
Wed, 25 May 2016 15:58:50 +0000 (17:58 +0200)
committerGiulio Fidente <gfidente@redhat.com>
Thu, 26 May 2016 15:50:49 +0000 (17:50 +0200)
Also wires in the steps into the CephStorage role.

Change-Id: Ib472f1279478ad7792349cc32bb3c5f510ba69fe

overcloud.yaml
puppet/ceph-storage-post.yaml
puppet/ceph-storage.yaml
puppet/manifests/overcloud_cephstorage.pp

index 6a42730..6a8081a 100644 (file)
@@ -733,7 +733,12 @@ parameters:
     type: json
     description: Optional scheduler hints to pass to nova
     default: {}
-
+  CephStorageServices:
+    default: []
+    description: A list of service resources (configured in the Heat
+                 resource_registry) which represent nested stacks
+                 for each service that should get installed on the CephStorage nodes.
+    type: comma_delimited_list
 
   # Hostname format for each role
   # Note %index% is translated into the index of the node, e.g 0/1/2 etc
@@ -1143,6 +1148,13 @@ resources:
           SchedulerHints: {get_param: ObjectStorageSchedulerHints}
           NodeIndex: '%index%'
 
+  CephStorageServiceChain:
+    type: OS::TripleO::Services
+    properties:
+      Services: {get_param: CephStorageServices}
+      EndpointMap: {get_attr: [EndpointMap, endpoint_map]}
+      MysqlVirtualIPUri: {get_attr: [VipMap, net_ip_uri_map, {get_param: [ServiceNetMap, MysqlNetwork]}]}
+
   CephStorage:
     type: OS::Heat::ResourceGroup
     depends_on: Networks
@@ -1170,6 +1182,7 @@ resources:
           ServerMetadata: {get_param: ServerMetadata}
           SchedulerHints: {get_param: CephStorageSchedulerHints}
           NodeIndex: '%index%'
+          ServiceConfigSettings: {get_attr: [CephStorageServiceChain, config_settings]}
 
   ControllerIpListMap:
     type: OS::TripleO::Network::Ports::NetIpListMap
@@ -1574,6 +1587,7 @@ resources:
         allnodes_extra: {get_attr: [AllNodesExtraConfig, config_identifier]}
         cephstorage_config: {get_attr: [CephStorage, attributes, config_identifier]}
         deployment_identifier: {get_param: DeployIdentifier}
+      StepConfig: {get_attr: [CephStorageServiceChain, step_config]}
 
 outputs:
   KeystoneURL:
index e90710c..2b9ae75 100644 (file)
@@ -13,6 +13,10 @@ parameters:
   NodeConfigIdentifiers:
      type: json
      description: Value which changes if the node configuration may need to be re-applied
+  StepConfig:
+    type: string
+    description: Config manifests that will be used to step through the deployment.
+    default: ''
 
 resources:
 
@@ -33,26 +37,44 @@ resources:
       group: puppet
       options:
         enable_debug: {get_param: ConfigDebug}
+        enable_hiera: True
+        enable_facter: False
+      inputs:
+      - name: step
       outputs:
       - name: result
       config:
-        get_file: manifests/overcloud_cephstorage.pp
+        list_join:
+        - ''
+        - - get_file: manifests/overcloud_cephstorage.pp
+          - {get_param: StepConfig}
 
-  CephStorageDeployment_Step1:
+  CephStorageDeployment_Step2:
     type: OS::Heat::StructuredDeployments
     depends_on: CephStorageArtifactsDeploy
     properties:
-      name: CephStorageDeployment_Step1
+      name: CephStorageDeployment_Step2
       servers:  {get_param: servers}
       config: {get_resource: CephStoragePuppetConfig}
       input_values:
+        step: 2
+        update_identifier: {get_param: NodeConfigIdentifiers}
+
+  CephStorageDeployment_Step3:
+    type: OS::Heat::StructuredDeployments
+    depends_on: CephStorageDeployment_Step2
+    properties:
+      name: CephStorageDeployment_Step3
+      servers:  {get_param: servers}
+      config: {get_resource: CephStoragePuppetConfig}
+      input_values:
+        step: 3
         update_identifier: {get_param: NodeConfigIdentifiers}
 
   # Note, this should come last, so use depends_on to ensure
   # this is created after any other resources.
   ExtraConfig:
-    depends_on: CephStorageDeployment_Step1
+    depends_on: CephStorageDeployment_Step3
     type: OS::TripleO::NodeExtraConfigPost
     properties:
         servers: {get_param: servers}
-
index d2b90c5..eedb35e 100644 (file)
@@ -96,6 +96,9 @@ parameters:
   NodeIndex:
     type: number
     default: 0
+  ServiceConfigSettings:
+    type: json
+    default: {}
 
 resources:
   CephStorage:
@@ -247,6 +250,7 @@ resources:
             - heat_config_%{::deploy_config_name}
             - ceph_extraconfig
             - extraconfig
+            - service_configs
             - ceph_cluster # provided by CephClusterConfig
             - ceph
             - '"%{::osfamily}"'
@@ -254,6 +258,8 @@ resources:
             - network
           merge_behavior: deeper
           datafiles:
+            service_configs:
+              mapped_data: {get_param: ServiceConfigSettings}
             common:
               raw_data: {get_file: hieradata/common.yaml}
             network:
index fd7faff..4add2f0 100644 (file)
 include ::tripleo::packages
 include ::tripleo::firewall
 
-create_resources(kmod::load, hiera('kernel_modules'), {})
-create_resources(sysctl::value, hiera('sysctl_settings'), {})
-Exec <| tag == 'kmod::load' |>  -> Sysctl <| |>
+if hiera('step') >= 1 {
 
-if count(hiera('ntp::servers')) > 0 {
-  include ::ntp
-}
+  create_resources(kmod::load, hiera('kernel_modules'), {})
+  create_resources(sysctl::value, hiera('sysctl_settings'), {})
+  Exec <| tag == 'kmod::load' |>  -> Sysctl <| |>
 
-include ::timezone
+  include ::timezone
 
-if str2bool(hiera('ceph_osd_selinux_permissive', true)) {
-  exec { 'set selinux to permissive on boot':
-    command => "sed -ie 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config",
-    onlyif  => "test -f /etc/selinux/config && ! grep '^SELINUX=permissive' /etc/selinux/config",
-    path    => ['/usr/bin', '/usr/sbin'],
+  if count(hiera('ntp::servers')) > 0 {
+    include ::ntp
   }
-
-  exec { 'set selinux to permissive':
-    command => 'setenforce 0',
-    onlyif  => "which setenforce && getenforce | grep -i 'enforcing'",
-    path    => ['/usr/bin', '/usr/sbin'],
-  } -> Class['ceph::profile::osd']
 }
 
-if str2bool(hiera('ceph_ipv6', false)) {
-  $mon_host = hiera('ceph_mon_host_v6')
-} else {
-  $mon_host = hiera('ceph_mon_host')
-}
-class { '::ceph::profile::params':
-  mon_host            => $mon_host,
-}
-include ::ceph::conf
-include ::ceph::profile::client
-include ::ceph::profile::osd
+if hiera('step') >= 3 {
+  if str2bool(hiera('ceph_osd_selinux_permissive', true)) {
+    exec { 'set selinux to permissive on boot':
+      command => "sed -ie 's/^SELINUX=.*/SELINUX=permissive/' /etc/selinux/config",
+      onlyif  => "test -f /etc/selinux/config && ! grep '^SELINUX=permissive' /etc/selinux/config",
+      path    => ['/usr/bin', '/usr/sbin'],
+    }
+
+    exec { 'set selinux to permissive':
+      command => 'setenforce 0',
+      onlyif  => "which setenforce && getenforce | grep -i 'enforcing'",
+      path    => ['/usr/bin', '/usr/sbin'],
+    } -> Class['ceph::profile::osd']
+  }
 
-hiera_include('ceph_classes')
-package_manifest{'/var/lib/tripleo/installed-packages/overcloud_ceph': ensure => present}
+  if str2bool(hiera('ceph_ipv6', false)) {
+    $mon_host = hiera('ceph_mon_host_v6')
+  } else {
+    $mon_host = hiera('ceph_mon_host')
+  }
+  class { '::ceph::profile::params':
+    mon_host            => $mon_host,
+  }
+  include ::ceph::conf
+  include ::ceph::profile::client
+  include ::ceph::profile::osd
+
+  hiera_include('ceph_classes')
+  package_manifest{'/var/lib/tripleo/installed-packages/overcloud_ceph': ensure => present}
+}