puppet: Add EnablePackageInstall option
authorDan Prince <dprince@redhat.com>
Thu, 5 Feb 2015 02:45:44 +0000 (21:45 -0500)
committerDan Prince <dprince@redhat.com>
Thu, 5 Feb 2015 15:12:48 +0000 (10:12 -0500)
This adds an option which enables package installation via
Yum when Puppet executes. Users might want to disable Yum
installation of packages via puppet when using pre-installed
images.

The option is off by default: meaning that Puppet will no
longer install packages by default. Users will need to
enable the EnablePackageInstall in order to get
the previous behavior.

The intent is to use the default_parameters section
of the Heat environment to allow users to cleanly enable this
features without wiring it into the top level. This is because
the new parameter is Puppet specific and doesn't really apply to
other implementations. Kilo Heat already has support for
default_parameters and so does python-heatclient.

NOTE: most TripleO users do not yet have the heatclient
features because setup-clienttools in tripleo-incubator only installs
releases via pip. It is for these reasons the default_parameters
section in overcloud-resource-registry-puppet.yaml is commented out
for now.

Change-Id: I3af71b801b87d080b367d9e4a1fb44c1bfea6e87

cinder-storage-puppet.yaml
compute-puppet.yaml
controller-puppet.yaml
overcloud-resource-registry-puppet.yaml
puppet/loadbalancer.pp
puppet/overcloud_compute.pp
puppet/overcloud_controller.pp
puppet/overcloud_object.pp
puppet/overcloud_volume.pp
puppet/ringbuilder.pp
swift-storage-puppet.yaml

index 508b483..433df32 100644 (file)
@@ -84,6 +84,10 @@ parameters:
   NtpServer:
     type: string
     default: ''
+  EnablePackageInstall:
+    default: 'false'
+    description: Set to true to enable package installation via Puppet
+    type: boolean
 
 resources:
   BlockStorage:
@@ -124,6 +128,7 @@ resources:
             template: '["server"]'
             params:
               server: {get_param: NtpServer}
+        enable_package_install: {get_param: EnablePackageInstall}
       signal_transport: NO_SIGNAL
 
   # Map heat metadata into hiera datafiles
@@ -153,6 +158,7 @@ resources:
                 cinder::rabbit_userid: {get_input: rabbit_username}
                 cinder::rabbit_password: {get_input: rabbit_password}
                 ntp::servers: {get_input: ntp_servers}
+                enable_package_install: {get_input: enable_package_install}
 
   VolumePuppetConfig:
     type: OS::Heat::SoftwareConfig
index 000ca8d..0448b7b 100644 (file)
@@ -227,7 +227,10 @@ parameters:
     description: The user password for SNMPd with readonly rights running on all Overcloud nodes
     type: string
     hidden: true
-
+  EnablePackageInstall:
+    default: 'false'
+    description: Set to true to enable package installation via Puppet
+    type: boolean
 
 resources:
 
@@ -336,6 +339,7 @@ resources:
                 neutron::rabbit_password: {get_input: rabbit_password}
                 ceilometer::rabbit_password: {get_input: rabbit_password}
                 ntp::servers: {get_input: ntp_servers}
+                enable_package_install: {get_input: enable_package_install}
 
   NovaComputeDeployment:
     type: OS::TripleO::SoftwareDeployment
@@ -385,6 +389,7 @@ resources:
             template: '["server"]'
             params:
               server: {get_param: NtpServer}
+        enable_package_install: {get_param: EnablePackageInstall}
 
 outputs:
   ip_address:
index 747c38a..5974f9e 100644 (file)
@@ -373,7 +373,10 @@ parameters:
   VirtualIP:
     type: string
     default: ''  # Has to be here because of the ignored empty value bug
-
+  EnablePackageInstall:
+    default: 'false'
+    description: Set to true to enable package installation via Puppet
+    type: boolean
 
 resources:
 
@@ -538,6 +541,7 @@ resources:
         swift_replicas: {get_param: SwiftReplicas}
         swift_min_part_hours: {get_param: SwiftMinPartHours}
         swift_mount_check: {get_param: SwiftMountCheck}
+        enable_package_install: {get_param: EnablePackageInstall}
 
   # Map heat metadata into hiera datafiles
   ControllerConfig:
@@ -704,6 +708,7 @@ resources:
                 controller_virtual_ip: {get_input: controller_virtual_ip}
                 public_virtual_interface: {get_input: public_virtual_interface}
                 public_virtual_ip: {get_input: public_virtual_ip}
+                enable_package_install: {get_input: enable_package_install}
 
   # NOTE(dprince): this example uses a composition class
   # on the puppet side (loadbalancer.pp). This seemed like the
index 6860708..f8e7cc9 100644 (file)
@@ -5,3 +5,7 @@ resource_registry:
   OS::TripleO::Controller: controller-puppet.yaml
   OS::TripleO::ObjectStorage: swift-storage-puppet.yaml
   OS::TripleO::Net::SoftwareConfig: net-config-bridge.yaml
+
+# NOTE(dprince): requires a new release of python-heatclient
+#default_parameters:
+  #EnablePackageInstall: false
index 84598da..88e6bdd 100644 (file)
 # 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.')
+    }
+  }
+}
+
 class tripleo::loadbalancer (
   $keystone_admin     = false,
   $keystone_public    = false,
index 693a06b..2ff31be 100644 (file)
 # 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.')
+    }
+  }
+}
+
 include ::ntp
 
 class { 'nova':
index 6af54a5..acfea68 100644 (file)
 # 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 hiera('step') >= 1 {
 
   include ::ntp
index d415c23..c407afa 100644 (file)
 # 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.')
+    }
+  }
+}
 include ::ntp
 
 include ::swift
index 91566bb..9351d70 100644 (file)
 # License for the specific language governing permissions and limitations
 # under the License.
 
+if str2bool(hiera('disable_package_install', 'false')) {
+  case $::osfamily {
+    'RedHat': {
+      Package { provider => 'norpm' } # provided by tripleo-puppet
+    }
+    default: {
+      warning('disable_package_install option not supported.')
+    }
+  }
+}
+
 include ::ntp
 
 include ::cinder
index 85f7eea..531706d 100644 (file)
 # License for the specific language governing permissions and limitations
 # under the License.
 
+if str2bool(hiera('disable_package_install', 'false')) {
+  case $::osfamily {
+    'RedHat': {
+      Package { provider => 'norpm' } # provided by tripleo-puppet
+    }
+    default: {
+      warning('disable_package_install option not supported.')
+    }
+  }
+}
+
 define add_devices(
   $swift_zones = '1'
 ){
index 26efffd..a529330 100644 (file)
@@ -47,6 +47,10 @@ parameters:
   NtpServer:
     type: string
     default: ''
+  EnablePackageInstall:
+    default: 'false'
+    description: Set to true to enable package installation via Puppet
+    type: boolean
 
 resources:
 
@@ -121,6 +125,7 @@ resources:
                 # NOTE(dprince): build_ring support is currently not wired in.
                 # See: https://review.openstack.org/#/c/109225/
                 tripleo::ringbuilder::build_ring: True
+                enable_package_install: {get_input: enable_package_install}
 
 
   SwiftStorageHieraDeploy:
@@ -143,6 +148,7 @@ resources:
             template: '["server"]'
             params:
               server: {get_param: NtpServer}
+        enable_package_install: {get_param: EnablePackageInstall}
 
 outputs:
   hosts_entry: