diff options
37 files changed, 753 insertions, 70 deletions
diff --git a/Puppetfile_extras b/Puppetfile_extras index b9f664f..ce158e4 100644 --- a/Puppetfile_extras +++ b/Puppetfile_extras @@ -29,3 +29,6 @@ mod 'datacat', :git => 'https://github.com/richardc/puppet-datacat', :ref => '0.6.2' +mod 'etcd', + :git => 'https://github.com/cristifalcas/puppet-etcd', + :ref => '1.10.0'
\ No newline at end of file diff --git a/lib/puppet/provider/package/norpm.rb b/lib/puppet/provider/package/norpm.rb index 0145d9f..0764265 100644 --- a/lib/puppet/provider/package/norpm.rb +++ b/lib/puppet/provider/package/norpm.rb @@ -33,6 +33,10 @@ Puppet::Type.type(:package).provide :norpm, :source => :rpm, :parent => :rpm do true end + def purge + true + end + def self.instances return [] end diff --git a/manifests/certmonger/mysql.pp b/manifests/certmonger/mysql.pp index 62aff9a..9cb6b13 100644 --- a/manifests/certmonger/mysql.pp +++ b/manifests/certmonger/mysql.pp @@ -31,11 +31,6 @@ # (Optional) The CA that certmonger will use to generate the certificates. # Defaults to hiera('certmonger_ca', 'local'). # -# [*mysql_network*] -# (Optional) The network name where the mysql endpoint is listening on. -# This is set by t-h-t. -# Defaults to hiera('mysql_network', undef) -# # [*principal*] # (Optional) The haproxy service principal that is set for MySQL in kerberos. # Defaults to undef @@ -45,16 +40,11 @@ class tripleo::certmonger::mysql ( $service_certificate, $service_key, $certmonger_ca = hiera('certmonger_ca', 'local'), - $mysql_network = hiera('mysql_network', undef), $principal = undef, ) { include ::certmonger include ::mysql::params - if !$mysql_network { - fail('mysql_network is not set in the hieradata.') - } - $postsave_cmd = "systemctl reload ${::mysql::params::service_name}" certmonger_certificate { 'mysql' : ensure => 'present', diff --git a/manifests/haproxy.pp b/manifests/haproxy.pp index 1e76733..2fa02c9 100644 --- a/manifests/haproxy.pp +++ b/manifests/haproxy.pp @@ -167,6 +167,10 @@ # (optional) Enable or not Nova API binding # Defaults to hiera('nova_api_enabled', false) # +# [*nova_placement*] +# (optional) Enable or not Nova Placement API binding +# Defaults to hiera('nova_placement_enabled', false) +# # [*nova_metadata*] # (optional) Enable or not Nova metadata binding # Defaults to hiera('nova_api_enabled', false) @@ -247,6 +251,10 @@ # (optional) Enable or not RabbitMQ binding # Defaults to false # +# [*etcd*] +# (optional) Enable or not Etcd binding +# Defaults to hiera('etcd_enabled', false) +# # [*docker_registry*] # (optional) Enable or not the Docker Registry API binding # Defaults to hiera('enable_docker_registry', false) @@ -376,6 +384,10 @@ # (optional) Specify the network nova_osapi is running on. # Defaults to hiera('nova_api_network', undef) # +# [*nova_placement_network*] +# (optional) Specify the network nova_placement is running on. +# Defaults to hiera('nova_placement_network', undef) +# # [*opendaylight_network*] # (optional) Specify the network opendaylight is running on. # Defaults to hiera('opendaylight_api_network', undef) @@ -444,6 +456,8 @@ # 'neutron_api_ssl_port' (Defaults to 13696) # 'nova_api_port' (Defaults to 8774) # 'nova_api_ssl_port' (Defaults to 13774) +# 'nova_placement_port' (Defaults to 8778) +# 'nova_placement_ssl_port' (Defaults to 13778) # 'nova_metadata_port' (Defaults to 8775) # 'nova_novnc_port' (Defaults to 6080) # 'nova_novnc_ssl_port' (Defaults to 13080) @@ -500,6 +514,7 @@ class tripleo::haproxy ( $glance_api = hiera('glance_api_enabled', false), $glance_registry = hiera('glance_registry_enabled', false), $nova_osapi = hiera('nova_api_enabled', false), + $nova_placement = hiera('nova_placement_enabled', false), $nova_metadata = hiera('nova_api_enabled', false), $nova_novncproxy = hiera('nova_vnc_proxy_enabled', false), $ceilometer = hiera('ceilometer_api_enabled', false), @@ -519,6 +534,7 @@ class tripleo::haproxy ( $mysql_clustercheck = false, $mysql_member_options = undef, $rabbitmq = false, + $etcd = hiera('etcd_enabled', false), $docker_registry = hiera('enable_docker_registry', false), $redis = hiera('redis_enabled', false), $redis_password = undef, @@ -551,6 +567,7 @@ class tripleo::haproxy ( $nova_metadata_network = hiera('nova_api_network', undef), $nova_novncproxy_network = hiera('nova_vnc_proxy_network', undef), $nova_osapi_network = hiera('nova_api_network', undef), + $nova_placement_network = hiera('nova_placement_network', undef), $panko_network = hiera('panko_api_network', undef), $ovn_dbs_network = hiera('ovn_dbs_network', undef), $sahara_network = hiera('sahara_api_network', undef), @@ -598,6 +615,8 @@ class tripleo::haproxy ( neutron_api_ssl_port => 13696, nova_api_port => 8774, nova_api_ssl_port => 13774, + nova_placement_port => 8778, + nova_placement_ssl_port => 13778, nova_metadata_port => 8775, nova_novnc_port => 6080, nova_novnc_ssl_port => 13080, @@ -704,6 +723,11 @@ class tripleo::haproxy ( "${redis_vip}:6379" => $haproxy_listen_bind_param, } + $etcd_vip = hiera('etcd_vip', $controller_virtual_ip) + $etcd_bind_opts = { + "${etcd_vip}:2379" => $haproxy_listen_bind_param, + } + class { '::haproxy': service_manage => $haproxy_service_manage, global_options => { @@ -928,6 +952,26 @@ class tripleo::haproxy ( } } + $nova_placement_vip = hiera('nova_placement_vip', $controller_virtual_ip) + if $nova_placement { + ::tripleo::haproxy::endpoint { 'nova_placement': + public_virtual_ip => $public_virtual_ip, + internal_ip => $nova_placement_vip, + service_port => $ports[nova_placement_port], + ip_addresses => hiera('nova_placement_node_ips', $controller_hosts_real), + server_names => hiera('nova_placement_node_names', $controller_hosts_names_real), + mode => 'http', + listen_options => { + 'http-request' => [ + 'set-header X-Forwarded-Proto https if { ssl_fc }', + 'set-header X-Forwarded-Proto http if !{ ssl_fc }'], + }, + public_ssl_port => $ports[nova_placement_ssl_port], + service_network => $nova_placement_network, + member_options => union($haproxy_member_options, $internal_tls_member_options), + } + } + if $nova_metadata { ::tripleo::haproxy::endpoint { 'nova_metadata': internal_ip => hiera('nova_metadata_vip', $controller_virtual_ip), @@ -1226,6 +1270,23 @@ class tripleo::haproxy ( } } + if $etcd { + haproxy::listen { 'etcd': + bind => $etcd_bind_opts, + options => { + 'balance' => 'source', + }, + collect_exported => false, + } + haproxy::balancermember { 'etcd': + listening_service => 'etcd', + ports => '2379', + ipaddresses => hiera('etcd_node_ips', $controller_hosts_real), + server_names => hiera('etcd_node_names', $controller_hosts_names_real), + options => $haproxy_member_options, + } + } + if $docker_registry { ::tripleo::haproxy::endpoint { 'docker-registry': public_virtual_ip => $public_virtual_ip, diff --git a/manifests/haproxy/endpoint.pp b/manifests/haproxy/endpoint.pp index 2f60b24..da2aba3 100644 --- a/manifests/haproxy/endpoint.pp +++ b/manifests/haproxy/endpoint.pp @@ -36,7 +36,7 @@ # # [*public_virtual_ip*] # Address in which the proxy endpoint will be listening in the public network. -# If this service is internal only this should be ommited. +# If this service is internal only this should be ommitted. # Defaults to undef. # # [*mode*] diff --git a/manifests/host/sriov.pp b/manifests/host/sriov.pp index a30db42..b94c472 100644 --- a/manifests/host/sriov.pp +++ b/manifests/host/sriov.pp @@ -21,7 +21,8 @@ class tripleo::host::sriov ( # the numvfs configuration needs to be persisted for every boot tripleo::host::sriov::numvfs_persistence {'persistent_numvfs': vf_defs => $number_of_vfs, - content_string => "#!/bin/bash\n" + content_string => "#!/bin/bash\n", + udev_rules => '' } } } diff --git a/manifests/host/sriov/numvfs_persistence.pp b/manifests/host/sriov/numvfs_persistence.pp index 1ee402c..ec8c875 100644 --- a/manifests/host/sriov/numvfs_persistence.pp +++ b/manifests/host/sriov/numvfs_persistence.pp @@ -10,9 +10,16 @@ # [*content_string*] # (required) String which shall be written to the script file. # +# [*udev_rules*] +# (required) String of lines to write to udev rules to ensure +# VFs are reconfigured if the PCI devices are removed and +# readded without rebooting (e.g. when physical functions were +# allocated to VMs) +# define tripleo::host::sriov::numvfs_persistence( $vf_defs, - $content_string + $content_string, + $udev_rules ){ # Since reduce isn't available, we use recursion to iterate each entries of # "physical_interface:vfs" and accumulate the content that needs to be @@ -36,6 +43,16 @@ define tripleo::host::sriov::numvfs_persistence( replace => false } + file { '/etc/udev/rules.d/70-tripleo-reset-sriov.rules': + ensure => file, + group => 'root', + mode => '0755', + owner => 'root', + content => $udev_rules, + replace => true, + } + + file_line { 'call_ifup-local': path => '/sbin/ifup-local', line => '/etc/sysconfig/allocate_vfs $1', @@ -46,9 +63,11 @@ define tripleo::host::sriov::numvfs_persistence( $interface = $vfspec[0] $count = $vfspec[1] $vfdef_str = "${content_string}[ \"${interface}\" == \"\$1\" ] && echo ${count} > /sys/class/net/${interface}/device/sriov_numvfs\n" + $udev_str = "${udev_rules}KERNEL==\"${interface}\", RUN+=\"/etc/sysconfig/allocate_vfs %k\"\n" tripleo::host::sriov::numvfs_persistence{"mapped ${interface}": vf_defs => delete_at($vf_defs, 0), - content_string => $vfdef_str + content_string => $vfdef_str, + udev_rules => $udev_str } } } diff --git a/manifests/profile/base/ceilometer/api.pp b/manifests/profile/base/ceilometer/api.pp index 2e7986b..6ef4748 100644 --- a/manifests/profile/base/ceilometer/api.pp +++ b/manifests/profile/base/ceilometer/api.pp @@ -18,10 +18,6 @@ # # === Parameters # -# [*enable_legacy_api*] -# (Optional) Enable legacy ceilometer api service. -# Defaults to hiera('enable_legacy_api', false) -# # [*ceilometer_network*] # (Optional) The network name where the ceilometer endpoint is listening on. # This is set by t-h-t. @@ -57,7 +53,6 @@ # Defaults to hiera('step') # class tripleo::profile::base::ceilometer::api ( - $enable_legacy_api = hiera('enable_legacy_ceilometer_api', false), $ceilometer_network = hiera('ceilometer_api_network', undef), $certificates_specs = hiera('apache_certificates_specs', {}), $enable_internal_tls = hiera('enable_internal_tls', false), @@ -81,7 +76,7 @@ class tripleo::profile::base::ceilometer::api ( $tls_keyfile = undef } - if $step >= 4 and $enable_legacy_api { + if $step >= 4 { include ::ceilometer::api class { '::ceilometer::wsgi::apache': ssl_cert => $tls_certfile, diff --git a/manifests/profile/base/cinder.pp b/manifests/profile/base/cinder.pp index 6a821f3..6e8fbb2 100644 --- a/manifests/profile/base/cinder.pp +++ b/manifests/profile/base/cinder.pp @@ -57,6 +57,7 @@ class tripleo::profile::base::cinder ( rabbit_hosts => $rabbit_endpoints, } include ::cinder::config + include ::cinder::glance } if $step >= 5 { diff --git a/manifests/profile/base/cinder/api.pp b/manifests/profile/base/cinder/api.pp index 5ea2058..450a8e6 100644 --- a/manifests/profile/base/cinder/api.pp +++ b/manifests/profile/base/cinder/api.pp @@ -94,7 +94,6 @@ class tripleo::profile::base::cinder::api ( ssl_key => $tls_keyfile, } include ::cinder::ceilometer - include ::cinder::glance } } diff --git a/manifests/profile/base/database/mysql.pp b/manifests/profile/base/database/mysql.pp index 1e53048..1692108 100644 --- a/manifests/profile/base/database/mysql.pp +++ b/manifests/profile/base/database/mysql.pp @@ -179,6 +179,9 @@ class tripleo::profile::base::database::mysql ( include ::nova::db::mysql include ::nova::db::mysql_api } + if hiera('nova_placement_enabled', false) { + include ::nova::db::mysql_placement + } if hiera('sahara_api_enabled', false) { include ::sahara::db::mysql } diff --git a/manifests/profile/base/etcd.pp b/manifests/profile/base/etcd.pp new file mode 100644 index 0000000..505e29f --- /dev/null +++ b/manifests/profile/base/etcd.pp @@ -0,0 +1,66 @@ +# Copyright 2016 Red Hat, Inc. +# +# 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. +# +# == Class: tripleo::profile::base::etcd +# +# etcd profile for tripleo +# +# === Parameters +# +# [*bind_ip*] +# (optional) IP to bind etcd service to. +# Defaults to '127.0.0.1'. +# +# [*client_port*] +# (optional) etcd client listening port. +# Defaults to '2379'. +# +# [*peer_port*] +# (optional) etcd peer listening port. +# Defaults to '2380'. +# +# [*nodes*] +# (Optional) Array of host(s) for etcd nodes. +# Defaults to hiera('etcd_node_ips', []). +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# +class tripleo::profile::base::etcd ( + $bind_ip = '127.0.0.1', + $client_port = '2379', + $peer_port = '2380', + $nodes = hiera('etcd_node_names', []), + $step = hiera('step'), +) { + if $step >= 1 { + if count($nodes) > 1 { + $cluster_enabled = true + } else { + $cluster_enabled = false + } + + class {'::etcd': + listen_client_urls => "http://${bind_ip}:${client_port}", + advertise_client_urls => "http://${bind_ip}:${client_port}", + listen_peer_urls => "http://${bind_ip}:${peer_port}", + initial_advertise_peer_urls => "http://${bind_ip}:${peer_port}", + initial_cluster => regsubst($nodes, '.+', "\\0=http://\\0:${peer_port}"), + cluster_enabled => $cluster_enabled, + proxy => 'off', + } + } +} diff --git a/manifests/profile/base/heat.pp b/manifests/profile/base/heat.pp index c743ce0..6e7e5f6 100644 --- a/manifests/profile/base/heat.pp +++ b/manifests/profile/base/heat.pp @@ -59,9 +59,7 @@ class tripleo::profile::base::heat ( manage_user => false, manage_role => false, } - } - if $step >= 4 { $rabbit_endpoints = suffix(any2array($rabbit_hosts), ":${rabbit_port}") class { '::heat' : notification_driver => $notification_driver, diff --git a/manifests/profile/base/keystone.pp b/manifests/profile/base/keystone.pp index 26e7b1f..a388def 100644 --- a/manifests/profile/base/keystone.pp +++ b/manifests/profile/base/keystone.pp @@ -236,6 +236,9 @@ class tripleo::profile::base::keystone ( if hiera('nova_api_enabled', false) { include ::nova::keystone::auth } + if hiera('nova_placement_enabled', false) { + include ::nova::keystone::auth_placement + } if hiera('panko_api_enabled', false) { include ::panko::keystone::auth } diff --git a/manifests/profile/base/nova.pp b/manifests/profile/base/nova.pp index dae627c..fe1e6a6 100644 --- a/manifests/profile/base/nova.pp +++ b/manifests/profile/base/nova.pp @@ -110,6 +110,7 @@ class tripleo::profile::base::nova ( } if $step >= 4 { + include ::nova::placement if $manage_migration { class { '::nova::migration::libvirt': configure_libvirt => $libvirt_enabled, diff --git a/manifests/profile/base/nova/api.pp b/manifests/profile/base/nova/api.pp index b4e3d74..8ded3ef 100644 --- a/manifests/profile/base/nova/api.pp +++ b/manifests/profile/base/nova/api.pp @@ -92,16 +92,18 @@ class tripleo::profile::base::nova::api ( $messaging_port_real = sprintf('%s', $::tripleo::profile::base::nova::messaging_port) $messaging_use_ssl_real = sprintf('%s', bool2num(str2bool($::tripleo::profile::base::nova::messaging_use_ssl))) - class { '::nova::db::sync_cell_v2': - transport_url => os_transport_url({ - 'transport' => $::tripleo::profile::base::nova::messaging_driver, - 'hosts' => $messaging_hosts_real, - 'port' => $messaging_port_real, - 'username' => $::tripleo::profile::base::nova::messaging_username, - 'password' => $::tripleo::profile::base::nova::messaging_password, - 'ssl' => $messaging_use_ssl_real, - }), - } + #TODO(emilien): enable it again when it's fixed upstream in nova + # https://bugs.launchpad.net/tripleo/+bug/1649341 + # class { '::nova::db::sync_cell_v2': + # transport_url => os_transport_url({ + # 'transport' => $::tripleo::profile::base::nova::messaging_driver, + # 'hosts' => $messaging_hosts_real, + # 'port' => $messaging_port_real, + # 'username' => $::tripleo::profile::base::nova::messaging_username, + # 'password' => $::tripleo::profile::base::nova::messaging_password, + # 'ssl' => $messaging_use_ssl_real, + # }), + # } } if $step >= 4 or ($step >= 3 and $sync_db) { diff --git a/manifests/profile/base/nova/placement.pp b/manifests/profile/base/nova/placement.pp new file mode 100644 index 0000000..aa8c3c7 --- /dev/null +++ b/manifests/profile/base/nova/placement.pp @@ -0,0 +1,96 @@ +# Copyright 2016 Red Hat, Inc. +# +# 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. +# +# == Class: tripleo::profile::base::nova::placement +# +# Nova Placement API profile for tripleo +# +# [*bootstrap_node*] +# (Optional) The hostname of the node responsible for bootstrapping tasks +# Defaults to hiera('bootstrap_nodeid') +# +# [*certificates_specs*] +# (Optional) The specifications to give to certmonger for the certificate(s) +# it will create. +# Example with hiera: +# apache_certificates_specs: +# httpd-internal_api: +# hostname: <overcloud controller fqdn> +# service_certificate: <service certificate path> +# service_key: <service key path> +# principal: "haproxy/<overcloud controller fqdn>" +# Defaults to hiera('apache_certificate_specs', {}). +# +# [*enable_internal_tls*] +# (Optional) Whether TLS in the internal network is enabled or not. +# Defaults to hiera('enable_internal_tls', false) +# +# [*generate_service_certificates*] +# (Optional) Whether or not certmonger will generate certificates for +# HAProxy. This could be as many as specified by the $certificates_specs +# variable. +# Note that this doesn't configure the certificates in haproxy, it merely +# creates the certificates. +# Defaults to hiera('generate_service_certificate', false). +# +# [*nova_placement_network*] +# (Optional) The network name where the nova placement endpoint is listening on. +# This is set by t-h-t. +# Defaults to hiera('nova_placement_network', undef) +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# +class tripleo::profile::base::nova::placement ( + $bootstrap_node = hiera('bootstrap_nodeid', undef), + $certificates_specs = hiera('apache_certificates_specs', {}), + $enable_internal_tls = hiera('enable_internal_tls', false), + $generate_service_certificates = hiera('generate_service_certificates', false), + $nova_placement_network = hiera('nova_placement_network', undef), + $step = hiera('step'), +) { + if $::hostname == downcase($bootstrap_node) { + $sync_db = true + } else { + $sync_db = false + } + + include ::tripleo::profile::base::nova + + if $enable_internal_tls { + if $generate_service_certificates { + ensure_resources('tripleo::certmonger::httpd', $certificates_specs) + } + + if !$nova_placement_network { + fail('nova_placement_network is not set in the hieradata.') + } + $tls_certfile = $certificates_specs["httpd-${nova_placement_network}"]['service_certificate'] + $tls_keyfile = $certificates_specs["httpd-${nova_placement_network}"]['service_key'] + } else { + $tls_certfile = undef + $tls_keyfile = undef + } + + if $step >= 4 { + class { '::nova::wsgi::apache_placement': + ssl_cert => $tls_certfile, + ssl_key => $tls_keyfile, + } + } + +} + diff --git a/manifests/profile/base/octavia.pp b/manifests/profile/base/octavia.pp new file mode 100644 index 0000000..46ca009 --- /dev/null +++ b/manifests/profile/base/octavia.pp @@ -0,0 +1,57 @@ +# Copyright 2016 Red Hat, Inc. +# +# 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. +# +# == Class: tripleo::profile::base::octavia +# +# Octavia server profile for tripleo +# +# === Parameters +# +# [*step*] +# (Optional) The current step of the deployment +# Defaults to hiera('step') +# +# [*rabbit_user*] +# [*rabbit_password*] +# (Optional) RabbitMQ user details +# Defaults to undef +# +# [*rabbit_hosts*] +# list of the rabbbit host fqdns +# Defaults to hiera('rabbitmq_node_names') +# +# [*rabbit_port*] +# IP port for rabbitmq service +# Defaults to 5672. +# +class tripleo::profile::base::octavia ( + $step = hiera('step'), + $rabbit_user = undef, + $rabbit_password = undef, + $rabbit_hosts = hiera('rabbitmq_node_names', undef), + $rabbit_port = '5672' +) { + if $step >= 3 { + class { '::octavia' : + default_transport_url => os_transport_url({ + 'transport' => 'rabbit', + 'hosts' => $rabbit_hosts, + 'port' => sprintf('%s', $rabbit_port), + 'username' => $rabbit_user, + 'password' => $rabbit_password + }) + } + include ::octavia::config + } +} diff --git a/manifests/profile/base/octavia/api.pp b/manifests/profile/base/octavia/api.pp new file mode 100644 index 0000000..d457478 --- /dev/null +++ b/manifests/profile/base/octavia/api.pp @@ -0,0 +1,54 @@ +# Copyright 2016 Red Hat, Inc. +# +# 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. +# +# == Class: tripleo::profile::base::octavia::api +# +# Octavia API server profile for tripleo +# +# === Parameters +# +# [*bootstrap_node*] +# (Optional) The hostname of the node responsible for bootstrapping tasks +# Defaults to hiera('bootstrap_nodeid') +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# +class tripleo::profile::base::octavia::api ( + $bootstrap_node = hiera('bootstrap_nodeid', undef), + $step = hiera('step'), +) { + if $::hostname == downcase($bootstrap_node) { + $sync_db = true + } else { + $sync_db = false + } + + include ::tripleo::profile::base::octavia + + if $step >= 3 and $sync_db { + include ::octavia::db::mysql + } + + # We start the Octavia API server on the bootstrap node first, because + # it will try to populate tables and we need to make sure this happens + # before it starts on other nodes + if ($step >= 4 and $sync_db) or ($step >= 5 and !$sync_db) { + class { '::octavia::api': + sync_db => $sync_db, + } + } +} diff --git a/manifests/profile/base/pacemaker.pp b/manifests/profile/base/pacemaker.pp index 19eb52b..671f1e7 100644 --- a/manifests/profile/base/pacemaker.pp +++ b/manifests/profile/base/pacemaker.pp @@ -31,7 +31,7 @@ class tripleo::profile::base::pacemaker ( try_sleep => 3, } - if $::hostname == downcase(hiera('bootstrap_nodeid')) { + if $::hostname == downcase(hiera('pacemaker_short_bootstrap_node_name')) { $pacemaker_master = true } else { $pacemaker_master = false diff --git a/manifests/profile/base/swift/proxy.pp b/manifests/profile/base/swift/proxy.pp index 7bbef1e..5bd75bd 100644 --- a/manifests/profile/base/swift/proxy.pp +++ b/manifests/profile/base/swift/proxy.pp @@ -80,5 +80,9 @@ class tripleo::profile::base::swift::proxy ( include ::swift::proxy::copy include ::swift::proxy::container_quotas include ::swift::proxy::account_quotas + + class { '::swift::objectexpirer': + memcache_servers => $swift_memcache_servers + } } } diff --git a/manifests/profile/base/swift/storage.pp b/manifests/profile/base/swift/storage.pp index 568be66..5018d77 100644 --- a/manifests/profile/base/swift/storage.pp +++ b/manifests/profile/base/swift/storage.pp @@ -34,8 +34,10 @@ class tripleo::profile::base::swift::storage ( ) { if $step >= 4 { if $enable_swift_storage { + include ::swift include ::swift::config include ::swift::storage::disks + include ::swift::storage::loopbacks include ::swift::storage::all if(!defined(File['/srv/node'])) { file { '/srv/node': diff --git a/manifests/profile/base/time/ntp.pp b/manifests/profile/base/time/ntp.pp new file mode 100644 index 0000000..c6ce309 --- /dev/null +++ b/manifests/profile/base/time/ntp.pp @@ -0,0 +1,28 @@ +# Copyright 2017 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. +# +# == Class: tripleo::profile::base::ntp +# +# Enable NTP via composable services. +# + +class tripleo::profile::base::time::ntp { + # if installed, we don't want chrony to conflict with ntp. + package { 'chrony': + ensure => 'purged', + before => Service['ntp'], + } + include ::ntp +} diff --git a/manifests/profile/pacemaker/cinder/backup.pp b/manifests/profile/pacemaker/cinder/backup.pp index 63988d6..4e33a34 100644 --- a/manifests/profile/pacemaker/cinder/backup.pp +++ b/manifests/profile/pacemaker/cinder/backup.pp @@ -20,7 +20,7 @@ # # [*bootstrap_node*] # (Optional) The hostname of the node responsible for bootstrapping tasks -# Defaults to hiera('bootstrap_nodeid') +# Defaults to hiera('cinder_backup_short_bootstrap_node_name') # # [*step*] # (Optional) The current step in deployment. See tripleo-heat-templates @@ -28,7 +28,7 @@ # Defaults to hiera('step') # class tripleo::profile::pacemaker::cinder::backup ( - $bootstrap_node = hiera('bootstrap_nodeid'), + $bootstrap_node = hiera('cinder_backup_short_bootstrap_node_name'), $step = hiera('step'), ) { diff --git a/manifests/profile/pacemaker/cinder/volume.pp b/manifests/profile/pacemaker/cinder/volume.pp index 46e8b79..b03a1f4 100644 --- a/manifests/profile/pacemaker/cinder/volume.pp +++ b/manifests/profile/pacemaker/cinder/volume.pp @@ -20,7 +20,7 @@ # # [*bootstrap_node*] # (Optional) The hostname of the node responsible for bootstrapping tasks -# Defaults to hiera('bootstrap_nodeid') +# Defaults to hiera('cinder_volume_short_bootstrap_node_name') # # [*step*] # (Optional) The current step in deployment. See tripleo-heat-templates @@ -28,7 +28,7 @@ # Defaults to hiera('step') # class tripleo::profile::pacemaker::cinder::volume ( - $bootstrap_node = hiera('bootstrap_nodeid'), + $bootstrap_node = hiera('cinder_volume_short_bootstrap_node_name'), $step = hiera('step'), ) { Service <| tag == 'cinder::volume' |> { diff --git a/manifests/profile/pacemaker/database/mysql.pp b/manifests/profile/pacemaker/database/mysql.pp index edd09bd..3506cb1 100644 --- a/manifests/profile/pacemaker/database/mysql.pp +++ b/manifests/profile/pacemaker/database/mysql.pp @@ -18,6 +18,10 @@ # # === Parameters # +# [*bootstrap_node*] +# (Optional) The hostname of the node responsible for bootstrapping tasks +# Defaults to hiera('mysql_short_bootstrap_node_name') +# # [*bind_address*] # (Optional) The address that the local mysql instance should bind to. # Defaults to $::hostname @@ -33,11 +37,12 @@ # Defaults to hiera('step') # class tripleo::profile::pacemaker::database::mysql ( + $bootstrap_node = hiera('mysql_short_bootstrap_node_name'), $bind_address = $::hostname, $gmcast_listen_addr = hiera('mysql_bind_host'), $step = hiera('step'), ) { - if $::hostname == downcase(hiera('bootstrap_nodeid')) { + if $::hostname == downcase($bootstrap_node) { $pacemaker_master = true } else { $pacemaker_master = false @@ -100,6 +105,7 @@ class tripleo::profile::pacemaker::database::mysql ( } class { '::tripleo::profile::base::database::mysql': + bootstrap_node => $bootstrap_node, manage_resources => false, remove_default_accounts => $remove_default_accounts, mysql_server_options => $mysqld_options, diff --git a/manifests/profile/pacemaker/database/redis.pp b/manifests/profile/pacemaker/database/redis.pp index 37c36aa..7490fa0 100644 --- a/manifests/profile/pacemaker/database/redis.pp +++ b/manifests/profile/pacemaker/database/redis.pp @@ -20,7 +20,7 @@ # # [*bootstrap_node*] # (Optional) The hostname of the node responsible for bootstrapping tasks -# Defaults to hiera('bootstrap_nodeid') +# Defaults to hiera('redis_short_bootstrap_node_name') # # [*enable_load_balancer*] # (Optional) Whether load balancing is enabled for this cluster @@ -37,7 +37,7 @@ # or 10240 (default in redis systemd limits) # class tripleo::profile::pacemaker::database::redis ( - $bootstrap_node = hiera('bootstrap_nodeid'), + $bootstrap_node = hiera('redis_short_bootstrap_node_name'), $enable_load_balancer = hiera('enable_load_balancer', true), $step = hiera('step'), $redis_file_limit = hiera('redis_file_limit', 10240), diff --git a/manifests/profile/pacemaker/haproxy.pp b/manifests/profile/pacemaker/haproxy.pp index 605bb15..b326761 100644 --- a/manifests/profile/pacemaker/haproxy.pp +++ b/manifests/profile/pacemaker/haproxy.pp @@ -20,7 +20,7 @@ # # [*bootstrap_node*] # (Optional) The hostname of the node responsible for bootstrapping tasks -# Defaults to hiera('bootstrap_nodeid') +# Defaults to hiera('haproxy_short_bootstrap_node_name') # # [*enable_load_balancer*] # (Optional) Whether load balancing is enabled for this cluster @@ -32,7 +32,7 @@ # Defaults to hiera('step') # class tripleo::profile::pacemaker::haproxy ( - $bootstrap_node = hiera('bootstrap_nodeid'), + $bootstrap_node = hiera('haproxy_short_bootstrap_node_name'), $enable_load_balancer = hiera('enable_load_balancer', true), $step = hiera('step'), ) { diff --git a/manifests/profile/pacemaker/manila.pp b/manifests/profile/pacemaker/manila.pp index 4d79782..547a86f 100644 --- a/manifests/profile/pacemaker/manila.pp +++ b/manifests/profile/pacemaker/manila.pp @@ -30,9 +30,15 @@ # (Optional) Whether or not the cephfs backend is enabled # Defaults to hiera('manila_backend_cephfs_enabled', false) # +# [*ceph_mds_enabled*] +# (Optional) Whether or not the ceph mds is enabled. This option is used +# to distinguish if an external ceph is used or if ceph is deployed by +# tripleo. By default ceph mds is not deployed by tripleo. +# Defaults to hiera('ceph_mds_enabled', false) +# # [*bootstrap_node*] # (Optional) The hostname of the node responsible for bootstrapping tasks -# Defaults to hiera('bootstrap_nodeid') +# Defaults to hiera('manila_share_short_bootstrap_node_name') # # [*step*] # (Optional) The current step in deployment. See tripleo-heat-templates @@ -43,7 +49,8 @@ class tripleo::profile::pacemaker::manila ( $backend_generic_enabled = hiera('manila_backend_generic_enabled', false), $backend_netapp_enabled = hiera('manila_backend_netapp_enabled', false), $backend_cephfs_enabled = hiera('manila_backend_cephfs_enabled', false), - $bootstrap_node = hiera('bootstrap_nodeid'), + $ceph_mds_enabled = hiera('ceph_mds_enabled', false), + $bootstrap_node = hiera('manila_share_short_bootstrap_node_name'), $step = hiera('step'), ) { if $::hostname == downcase($bootstrap_node) { @@ -95,14 +102,42 @@ class tripleo::profile::pacemaker::manila ( # manila cephfsnative: if $backend_cephfs_enabled { $manila_cephfsnative_backend = hiera('manila::backend::cephfsnative::title') + $cephfs_auth_id = hiera('manila::backend::cephfsnative::cephfs_auth_id') + $keyring_path = "/etc/ceph/ceph.client.${cephfs_auth_id}.keyring" + + # $ceph_mds_enabled is used to distinguish if an external ceph is used or + # if ceph is deployed by TripleO + if $ceph_mds_enabled { + include ::ceph::profile::fs + } + manila::backend::cephfsnative { $manila_cephfsnative_backend : driver_handles_share_servers => hiera('manila::backend::cephfsnative::driver_handles_share_servers', false), share_backend_name => hiera('manila::backend::cephfsnative::share_backend_name'), cephfs_conf_path => hiera('manila::backend::cephfsnative::cephfs_conf_path'), - cephfs_auth_id => hiera('manila::backend::cephfsnative::cephfs_auth_id'), + cephfs_auth_id => $cephfs_auth_id, cephfs_cluster_name => hiera('manila::backend::cephfsnative::cephfs_cluster_name'), cephfs_enable_snapshots => hiera('manila::backend::cephfsnative::cephfs_enable_snapshots'), } + + ceph::key { "client.${cephfs_auth_id}" : + secret => hiera('manila::backend::cephfsnative::ceph_client_key'), + keyring_path => $keyring_path, + # inject the new key into ceph cluster only if ceph is deployed by + # tripleo (if external ceph is used it should be added manually) + inject => $ceph_mds_enabled, + user => 'manila', + cap_mds => 'allow *', + cap_mon => 'allow r, allow command \"auth del\", allow command \"auth caps\", \ +allow command \"auth get\", allow command \"auth get-or-create\"', + cap_osd => 'allow rw' + } + + ceph_config { + "client.${cephfs_auth_id}/keyring": value => $keyring_path; + "client.${cephfs_auth_id}/client mount uid": value => 0; + "client.${cephfs_auth_id}/client mount gid": value => 0; + } } # manila netapp: diff --git a/manifests/profile/pacemaker/rabbitmq.pp b/manifests/profile/pacemaker/rabbitmq.pp index dba01e3..85ebe34 100644 --- a/manifests/profile/pacemaker/rabbitmq.pp +++ b/manifests/profile/pacemaker/rabbitmq.pp @@ -20,7 +20,7 @@ # # [*bootstrap_node*] # (Optional) The hostname of the node responsible for bootstrapping tasks -# Defaults to hiera('bootstrap_nodeid') +# Defaults to hiera('rabbitmq_short_bootstrap_node_name') # # [*erlang_cookie*] # (Optional) Content of erlang cookie. @@ -42,7 +42,7 @@ # Defaults to hiera('step') # class tripleo::profile::pacemaker::rabbitmq ( - $bootstrap_node = hiera('bootstrap_nodeid'), + $bootstrap_node = hiera('rabbitmq_short_bootstrap_node_name'), $erlang_cookie = hiera('rabbitmq::erlang_cookie'), $user_ha_queues = hiera('rabbitmq::nr_ha_queues', 0), $rabbit_nodes = hiera('rabbitmq_node_names'), diff --git a/spec/classes/tripleo_profile_base_ceilometer_api_spec.rb b/spec/classes/tripleo_profile_base_ceilometer_api_spec.rb index 2887d32..acc9b51 100644 --- a/spec/classes/tripleo_profile_base_ceilometer_api_spec.rb +++ b/spec/classes/tripleo_profile_base_ceilometer_api_spec.rb @@ -32,10 +32,9 @@ describe 'tripleo::profile::base::ceilometer::api' do end end - context 'with step 4 and enable_legacy_api' do + context 'with step 4' do let(:params) { { - :step => 4, - :enable_legacy_api => true, + :step => 4, } } it 'should trigger complete configuration' do @@ -43,17 +42,6 @@ describe 'tripleo::profile::base::ceilometer::api' do is_expected.to contain_class('ceilometer::wsgi::apache') end end - - context 'with step 4 and default enable_legacy_api' do - let(:params) { { - :step => 4, - } } - - it 'should do nothing' do - is_expected.to_not contain_class('ceilometer::api') - is_expected.to_not contain_class('ceilometer::wsgi::apache') - end - end end diff --git a/spec/classes/tripleo_profile_base_cinder_api_spec.rb b/spec/classes/tripleo_profile_base_cinder_api_spec.rb index a0c607d..6a36632 100644 --- a/spec/classes/tripleo_profile_base_cinder_api_spec.rb +++ b/spec/classes/tripleo_profile_base_cinder_api_spec.rb @@ -30,7 +30,6 @@ describe 'tripleo::profile::base::cinder::api' do is_expected.to contain_class('tripleo::profile::base::cinder') is_expected.to_not contain_class('cinder::api') is_expected.to_not contain_class('cinder::ceilometer') - is_expected.to_not contain_class('cinder::glance') end end @@ -43,7 +42,6 @@ describe 'tripleo::profile::base::cinder::api' do it 'should trigger complete configuration' do is_expected.to contain_class('cinder::api') is_expected.to contain_class('cinder::ceilometer') - is_expected.to contain_class('cinder::glance') end end @@ -56,7 +54,6 @@ describe 'tripleo::profile::base::cinder::api' do it 'should not trigger any configuration' do is_expected.to_not contain_class('cinder::api') is_expected.to_not contain_class('cinder::ceilometer') - is_expected.to_not contain_class('cinder::glance') end end @@ -68,7 +65,6 @@ describe 'tripleo::profile::base::cinder::api' do it 'should trigger complete configuration' do is_expected.to contain_class('cinder::api') is_expected.to contain_class('cinder::ceilometer') - is_expected.to contain_class('cinder::glance') end end end diff --git a/spec/classes/tripleo_profile_base_cinder_spec.rb b/spec/classes/tripleo_profile_base_cinder_spec.rb index 6a36152..81fa047 100644 --- a/spec/classes/tripleo_profile_base_cinder_spec.rb +++ b/spec/classes/tripleo_profile_base_cinder_spec.rb @@ -24,6 +24,7 @@ describe 'tripleo::profile::base::cinder' do is_expected.to contain_class('tripleo::profile::base::cinder') is_expected.to_not contain_class('cinder') is_expected.to_not contain_class('cinder::config') + is_expected.to_not contain_class('cinder::glance') is_expected.to_not contain_class('cinder:::cron::db_purge') end end @@ -41,6 +42,7 @@ describe 'tripleo::profile::base::cinder' do :rabbit_hosts => params[:rabbit_hosts].map{ |h| "#{h}:#{params[:rabbit_port]}" } ) is_expected.to contain_class('cinder::config') + is_expected.to contain_class('cinder::glance') is_expected.to_not contain_class('cinder::cron::db_purge') end end @@ -54,6 +56,7 @@ describe 'tripleo::profile::base::cinder' do it 'should not trigger any configuration' do is_expected.to_not contain_class('cinder') is_expected.to_not contain_class('cinder::config') + is_expected.to_not contain_class('cinder::glance') is_expected.to_not contain_class('cinder:::cron::db_purge') end end @@ -71,6 +74,7 @@ describe 'tripleo::profile::base::cinder' do :rabbit_hosts => params[:rabbit_hosts].map{ |h| "#{h}:#{params[:rabbit_port]}" } ) is_expected.to contain_class('cinder::config') + is_expected.to contain_class('cinder::glance') is_expected.to_not contain_class('cinder:::cron::db_purge') end end @@ -87,6 +91,7 @@ describe 'tripleo::profile::base::cinder' do :rabbit_hosts => params[:rabbit_hosts].map{ |h| "#{h}:5672" } ) is_expected.to contain_class('cinder::config') + is_expected.to contain_class('cinder::glance') is_expected.to contain_class('cinder::cron::db_purge') end end @@ -104,6 +109,7 @@ describe 'tripleo::profile::base::cinder' do :rabbit_hosts => params[:rabbit_hosts].map{ |h| "#{h}:5672" } ) is_expected.to contain_class('cinder::config') + is_expected.to contain_class('cinder::glance') is_expected.to_not contain_class('cinder::cron::db_purge') end end diff --git a/spec/classes/tripleo_profile_base_nova_api_spec.rb b/spec/classes/tripleo_profile_base_nova_api_spec.rb index 0d2564d..4aa7367 100644 --- a/spec/classes/tripleo_profile_base_nova_api_spec.rb +++ b/spec/classes/tripleo_profile_base_nova_api_spec.rb @@ -53,9 +53,11 @@ eos it { is_expected.to contain_class('tripleo::profile::base::nova::api') is_expected.to contain_class('tripleo::profile::base::nova') - is_expected.to contain_class('nova::db::sync_cell_v2').with( - :transport_url => 'rabbit://nova:foo@localhost:5672/?ssl=0') - is_expected.to contain_class('nova::keystone::authtoken') + #TODO(emilien): enable it again when it's fixed upstream in nova + # https://bugs.launchpad.net/tripleo/+bug/1649341 + # is_expected.to contain_class('nova::db::sync_cell_v2').with( + # :transport_url => 'rabbit://nova:foo@localhost:5672/?ssl=0') + # is_expected.to contain_class('nova::keystone::authtoken') is_expected.to contain_class('nova::api') is_expected.to contain_class('nova::wsgi::apache_api') is_expected.to contain_class('nova::network::neutron') diff --git a/spec/classes/tripleo_profile_base_octavia_api_spec.rb b/spec/classes/tripleo_profile_base_octavia_api_spec.rb new file mode 100644 index 0000000..d916a32 --- /dev/null +++ b/spec/classes/tripleo_profile_base_octavia_api_spec.rb @@ -0,0 +1,135 @@ +# +# Copyright (C) 2016 Red Hat, Inc. +# +# 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. +# + +require 'spec_helper' + +describe 'tripleo::profile::base::octavia::api' do + + let :params do + { :step => 5, + :bootstrap_node => 'notbootstrap.example.com' + } + end + + shared_examples_for 'tripleo::profile::base::octavia::api' do + before :each do + facts.merge!({ :step => params[:step] }) + end + + let(:pre_condition) do + <<-eos + class { 'tripleo::profile::base::octavia' : + step => #{params[:step]}, + rabbit_user => 'bugs', + rabbit_password => 'rabbits_R_c00l', + rabbit_hosts => ['hole.field.com'] + } + class { 'octavia::db::mysql': + password => 'some_password' + } +eos + end + + context 'with step less than 3 on bootstrap' do + before do + params.merge!({ + :step => 2, + :bootstrap_node => 'node.example.com' + }) + end + + it 'should not do anything' do + is_expected.to_not contain_class('octavia::api') + end + end + + context 'with step less than 3 on non-bootstrap' do + before do + params.merge!({ :step => 2 }) + end + + it 'should not do anything' do + is_expected.to_not contain_class('octavia::api') + end + end + + context 'with step 3 on bootstrap node' do + before do + params.merge!({ + :step => 3, + :bootstrap_node => 'node.example.com' + }) + end + + it 'should should start configurating database' do + is_expected.to_not contain_class('octavia::api') + end + end + + context 'with step 3 on non-bootstrap node' do + before do + params.merge!({ :step => 3 }) + end + + it 'should do nothing' do + is_expected.to_not contain_class('octavia::api') + end + end + + context 'with step 4 on bootstrap node' do + before do + params.merge!({ + :step => 4, + :bootstrap_node => 'node.example.com' + }) + end + + it 'should should sync database' do + is_expected.to contain_class('octavia::api').with(:sync_db => true) + end + end + + context 'with step 4 on non-bootstrap node' do + before do + params.merge!({ :step => 4 }) + end + + it 'should do nothing' do + is_expected.to_not contain_class('octavia::api') + end + end + + context 'with step 5 on non-bootstrap node' do + before do + params.merge!({ :step => 5 }) + end + + it 'should do nothing' do + is_expected.to contain_class('octavia::api').with(:sync_db => false) + end + end + end + + on_supported_os.each do |os, facts| + context "on #{os}" do + let(:facts) do + facts.merge({ :hostname => 'node.example.com' }) + end + it_behaves_like 'tripleo::profile::base::octavia::api' + end + end +end + diff --git a/spec/classes/tripleo_profile_base_octavia_spec.rb b/spec/classes/tripleo_profile_base_octavia_spec.rb new file mode 100644 index 0000000..89820ef --- /dev/null +++ b/spec/classes/tripleo_profile_base_octavia_spec.rb @@ -0,0 +1,119 @@ +# +# Copyright (C) 2016 Red Hat, Inc. +# +# 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. +# + +require 'spec_helper' + +describe 'tripleo::profile::base::octavia' do + + let :params do + { :rabbit_hosts => ['some.server.com'], + :step => 5 + } + end + + shared_examples_for 'tripleo::profile::base::octavia' do + + context 'with step less than 3' do + before do + params.merge!({ :step => 2 }) + end + + it 'should not do anything' do + is_expected.to_not contain_class('octavia') + is_expected.to_not contain_class('octavia::config') + end + end + + context 'with step 3' do + before do + params.merge!({ :step => 3 }) + end + + it 'should provide basic initialization' do + is_expected.to contain_class('octavia').with( + :default_transport_url => 'rabbit://some.server.com:5672/' + ) + is_expected.to contain_class('octavia::config') + end + end + + context 'with multiple hosts' do + before do + params.merge!({ :rabbit_hosts => ['some.server.com', 'someother.server.com'] }) + end + + it 'should construct a multihost URL' do + is_expected.to contain_class('octavia').with( + :default_transport_url => 'rabbit://some.server.com:5672,someother.server.com:5672/' + ) + end + end + + context 'with username provided' do + before do + params.merge!({ :rabbit_user => 'bunny' }) + end + + it 'should construct URL with username' do + is_expected.to contain_class('octavia').with( + :default_transport_url => 'rabbit://bunny@some.server.com:5672/' + ) + end + end + + context 'with username and password provided' do + before do + params.merge!( + { :rabbit_user => 'bunny', + :rabbit_password => 'carrot' + } + ) + end + + it 'should construct URL with username and password' do + is_expected.to contain_class('octavia').with( + :default_transport_url => 'rabbit://bunny:carrot@some.server.com:5672/' + ) + end + end + + context 'with multiple hosts and user info provided' do + before do + params.merge!( + { :rabbit_hosts => ['some.server.com', 'someother.server.com'], + :rabbit_user => 'bunny', + :rabbit_password => 'carrot' + } + ) + end + + it 'should distributed user info across hosts URL' do + is_expected.to contain_class('octavia').with( + :default_transport_url => 'rabbit://bunny:carrot@some.server.com:5672,bunny:carrot@someother.server.com:5672/' + ) + end + end + end + + on_supported_os.each do |os, facts| + context "on #{os}" do + let(:facts) do + facts.merge({}) + end + it_behaves_like 'tripleo::profile::base::octavia' + end + end +end diff --git a/spec/defines/tripleo_host_sriov_numvfs_persistence_spec.rb b/spec/defines/tripleo_host_sriov_numvfs_persistence_spec.rb index 57559a2..153b105 100644 --- a/spec/defines/tripleo_host_sriov_numvfs_persistence_spec.rb +++ b/spec/defines/tripleo_host_sriov_numvfs_persistence_spec.rb @@ -12,7 +12,8 @@ describe 'tripleo::host::sriov::numvfs_persistence' do { :name => 'persistence', :vf_defs => ['eth0:10','eth1:8'], - :content_string => "Hashbang\n" + :content_string => "Hashbang\n", + :udev_rules => "" } end @@ -31,6 +32,14 @@ describe 'tripleo::host::sriov::numvfs_persistence' do :content => '#!/bin/bash', :replace => false, ) + is_expected.to contain_file('/etc/udev/rules.d/70-tripleo-reset-sriov.rules').with( + :ensure => 'file', + :content => "KERNEL==\"eth0\", RUN+=\"/etc/sysconfig/allocate_vfs %k\"\nKERNEL==\"eth1\", RUN+=\"/etc/sysconfig/allocate_vfs %k\"\n", + :group => 'root', + :mode => '0755', + :owner => 'root', + :replace => true + ) is_expected.to contain_file_line('call_ifup-local').with( :path => '/sbin/ifup-local', :line => '/etc/sysconfig/allocate_vfs $1', |