spof: create resources on RH systems
For now, the provider does not work, and it needs some investigation. During this time, let's simply use the exec provider.
This commit is contained in:
@@ -39,6 +39,15 @@ fixtures:
|
|||||||
'concat':
|
'concat':
|
||||||
repo: 'git://github.com/enovance/puppet-concat.git'
|
repo: 'git://github.com/enovance/puppet-concat.git'
|
||||||
ref: '04356974f72b90a1d0f57346a00e95a717924e43'
|
ref: '04356974f72b90a1d0f57346a00e95a717924e43'
|
||||||
|
'corosync':
|
||||||
|
repo: 'git://github.com/enovance/puppetlabs-corosync.git'
|
||||||
|
ref: '79b61302b07fef30b65a42f3b55229616018aacf'
|
||||||
|
'firewall':
|
||||||
|
repo: 'git://github.com/enovance/puppetlabs-firewall.git'
|
||||||
|
ref: '6540b31b0ca0727094ddf44436274436d2853d6d'
|
||||||
|
'pacemaker':
|
||||||
|
repo: 'git://github.com/enovance/puppet-pacemaker.git'
|
||||||
|
ref: '7e304243b5bd2dced5f54d5146ecc58d0b5a51f1'
|
||||||
'elasticsearch':
|
'elasticsearch':
|
||||||
repo: 'git://github.com/enovance/puppet-elasticsearch.git'
|
repo: 'git://github.com/enovance/puppet-elasticsearch.git'
|
||||||
ref: '042720d52a3879786c2f9d9f67961c4f42004fae'
|
ref: '042720d52a3879786c2f9d9f67961c4f42004fae'
|
||||||
|
@@ -115,7 +115,7 @@ mod 'ntp',
|
|||||||
:ref => 'eb02ba2937ce86fb609ae41499767244b78ec58d'
|
:ref => 'eb02ba2937ce86fb609ae41499767244b78ec58d'
|
||||||
mod 'pacemaker',
|
mod 'pacemaker',
|
||||||
:git => 'git://github.com/enovance/puppet-pacemaker.git',
|
:git => 'git://github.com/enovance/puppet-pacemaker.git',
|
||||||
:ref => '1102d9861d8a63cc1577bc97a4415b9ff7488038'
|
:ref => '7e304243b5bd2dced5f54d5146ecc58d0b5a51f1'
|
||||||
mod 'rabbitmq',
|
mod 'rabbitmq',
|
||||||
:git => 'git://github.com/enovance/puppetlabs-rabbitmq.git',
|
:git => 'git://github.com/enovance/puppetlabs-rabbitmq.git',
|
||||||
:ref => '25420cb3c26c9a8432ab519d43c094d614d4fec4'
|
:ref => '25420cb3c26c9a8432ab519d43c094d614d4fec4'
|
||||||
|
@@ -22,7 +22,6 @@
|
|||||||
# [*cluster_ip*]
|
# [*cluster_ip*]
|
||||||
# (optional) Interface used by Corosync to send multicast traffic
|
# (optional) Interface used by Corosync to send multicast traffic
|
||||||
# Defaults to '127.0.0.1'
|
# Defaults to '127.0.0.1'
|
||||||
#
|
|
||||||
# [*cluster_members*]
|
# [*cluster_members*]
|
||||||
# (required on Red Hat) A space-separted list of cluster IP's or names
|
# (required on Red Hat) A space-separted list of cluster IP's or names
|
||||||
# Defaults to false
|
# Defaults to false
|
||||||
@@ -39,7 +38,7 @@ class cloud::spof(
|
|||||||
$cluster_password = 'secrete'
|
$cluster_password = 'secrete'
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if $::operatingsystem == 'RedHat' {
|
if $::osfamily == 'RedHat' {
|
||||||
if ! $cluster_members {
|
if ! $cluster_members {
|
||||||
fail('cluster_members is a required parameter.')
|
fail('cluster_members is a required parameter.')
|
||||||
}
|
}
|
||||||
@@ -62,17 +61,23 @@ class cloud::spof(
|
|||||||
owner => 'root',
|
owner => 'root',
|
||||||
group => 'root',
|
group => 'root',
|
||||||
} ->
|
} ->
|
||||||
pcmk_resource { 'ceilometer-agent-central':
|
exec {'pcmk_ceilometer_agent_central':
|
||||||
resource_type => 'ocf:heartbeat:ceilometer-agent-central'
|
command => 'pcs resource create ceilometer-agent-central ocf:heartbeat:ceilometer-agent-central',
|
||||||
} ->
|
path => ['/usr/bin','/usr/sbin','/sbin/','/bin'],
|
||||||
|
user => 'root',
|
||||||
|
unless => '/usr/sbin/pcs resource | /bin/grep ceilometer-agent-central | /bin/grep Started'
|
||||||
|
}
|
||||||
file { '/usr/lib/ocf/resource.d/heartbeat/heat-engine':
|
file { '/usr/lib/ocf/resource.d/heartbeat/heat-engine':
|
||||||
source => 'puppet:///modules/cloud/heartbeat/heat-engine',
|
source => 'puppet:///modules/cloud/heartbeat/heat-engine',
|
||||||
mode => '0755',
|
mode => '0755',
|
||||||
owner => 'root',
|
owner => 'root',
|
||||||
group => 'root',
|
group => 'root',
|
||||||
} ->
|
} ->
|
||||||
pcmk_resource { 'heat-engine':
|
exec {'pcmk_heat_engine':
|
||||||
resource_type => 'ocf:heartbeat:heat-engine'
|
command => 'pcs resource create heat-engine ocf:heartbeat:heat-engine',
|
||||||
|
path => ['/usr/bin','/usr/sbin','/sbin/','/bin'],
|
||||||
|
user => 'root',
|
||||||
|
unless => '/usr/sbin/pcs resource | /bin/grep heat-engine | /bin/grep Started'
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
130
spec/classes/cloud_spof_spec.rb
Normal file
130
spec/classes/cloud_spof_spec.rb
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# Unit tests for cloud::spof class
|
||||||
|
#
|
||||||
|
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'cloud::spof' do
|
||||||
|
|
||||||
|
shared_examples_for 'cloud spof' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
{ :cluster_ip => '10.0.0.1',
|
||||||
|
:multicast_address => '239.1.1.2',
|
||||||
|
:cluster_members => false,
|
||||||
|
:cluster_password => 'verysecrete' }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with Pacemaker on Debian' do
|
||||||
|
before :each do
|
||||||
|
facts.merge!( :osfamily => 'Debian' )
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'configure pacemaker/corosync' do
|
||||||
|
should contain_class('corosync').with(
|
||||||
|
:enable_secauth => false,
|
||||||
|
:authkey => '/var/lib/puppet/ssl/certs/ca.pem',
|
||||||
|
:bind_address => '10.0.0.1',
|
||||||
|
:multicast_address => '239.1.1.2',
|
||||||
|
)
|
||||||
|
should contain_file('/usr/lib/ocf/resource.d/heartbeat/ceilometer-agent-central').with(
|
||||||
|
:source => 'puppet:///modules/cloud/heartbeat/ceilometer-agent-central',
|
||||||
|
:mode => '0755',
|
||||||
|
:owner => 'root',
|
||||||
|
:group => 'root'
|
||||||
|
)
|
||||||
|
should contain_file('/usr/lib/ocf/resource.d/heartbeat/heat-engine').with(
|
||||||
|
:source => 'puppet:///modules/cloud/heartbeat/heat-engine',
|
||||||
|
:mode => '0755',
|
||||||
|
:owner => 'root',
|
||||||
|
:group => 'root'
|
||||||
|
)
|
||||||
|
should contain_class('cloud::orchestration::engine').with(:enabled => false)
|
||||||
|
should contain_class('cloud::telemetry::centralagent').with(:enabled => false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with Pacemaker on Red-Hat' do
|
||||||
|
before :each do
|
||||||
|
facts.merge!( :osfamily => 'RedHat' )
|
||||||
|
params.merge!( :cluster_members => 'srv1 srv2 srv3')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'configure pacemaker/corosync' do
|
||||||
|
should contain_class('pacemaker').with(:hacluster_pwd => 'verysecrete')
|
||||||
|
should contain_class('pacemaker::stonith').with(:disable => true)
|
||||||
|
should contain_class('pacemaker::corosync').with(
|
||||||
|
:cluster_name => 'openstack',
|
||||||
|
:cluster_members => 'srv1 srv2 srv3')
|
||||||
|
should contain_file('/usr/lib/ocf/resource.d/heartbeat/ceilometer-agent-central').with(
|
||||||
|
:source => 'puppet:///modules/cloud/heartbeat/ceilometer-agent-central',
|
||||||
|
:mode => '0755',
|
||||||
|
:owner => 'root',
|
||||||
|
:group => 'root'
|
||||||
|
)
|
||||||
|
should contain_file('/usr/lib/ocf/resource.d/heartbeat/heat-engine').with(
|
||||||
|
:source => 'puppet:///modules/cloud/heartbeat/heat-engine',
|
||||||
|
:mode => '0755',
|
||||||
|
:owner => 'root',
|
||||||
|
:group => 'root'
|
||||||
|
)
|
||||||
|
should contain_exec('pcmk_ceilometer_agent_central').with(
|
||||||
|
:command => 'pcs resource create ceilometer-agent-central ocf:heartbeat:ceilometer-agent-central',
|
||||||
|
:path => ['/usr/bin','/usr/sbin','/sbin/','/bin'],
|
||||||
|
:user => 'root',
|
||||||
|
:unless => '/usr/sbin/pcs resource | /bin/grep ceilometer-agent-central | /bin/grep Started'
|
||||||
|
)
|
||||||
|
should contain_exec('pcmk_heat_engine').with(
|
||||||
|
:command => 'pcs resource create heat-engine ocf:heartbeat:heat-engine',
|
||||||
|
:path => ['/usr/bin','/usr/sbin','/sbin/','/bin'],
|
||||||
|
:user => 'root',
|
||||||
|
:unless => '/usr/sbin/pcs resource | /bin/grep heat-engine | /bin/grep Started'
|
||||||
|
)
|
||||||
|
should contain_class('cloud::orchestration::engine').with(:enabled => false)
|
||||||
|
should contain_class('cloud::telemetry::centralagent').with(:enabled => false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with Pacemaker on Red-Hat with missing parameters' do
|
||||||
|
before :each do
|
||||||
|
facts.merge!( :osfamily => 'RedHat' )
|
||||||
|
params.merge!( :cluster_members => false)
|
||||||
|
end
|
||||||
|
it { should compile.and_raise_error(/cluster_members is a required parameter./) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'on Debian platforms' do
|
||||||
|
let :facts do
|
||||||
|
{ :osfamily => 'Debian',
|
||||||
|
:concat_basedir => '/var/lib/puppet/concat',
|
||||||
|
:uniqueid => '123' }
|
||||||
|
end
|
||||||
|
|
||||||
|
it_configures 'cloud spof'
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'on RedHat platforms' do
|
||||||
|
let :facts do
|
||||||
|
{ :osfamily => 'RedHat',
|
||||||
|
:concat_basedir => '/var/lib/puppet/concat',
|
||||||
|
:uniqueid => '123' }
|
||||||
|
end
|
||||||
|
it_configures 'cloud spof'
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Reference in New Issue
Block a user