From e6e5c69576ecd989c37631cb6064c758ce7a8283 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Tue, 2 Dec 2014 18:24:07 +0100 Subject: [PATCH] Update pacemaker to 01bc4942485abc3a8f46b055c8c8418ca9d81d9e 01bc4942485abc3a8f46b055c8c8418ca9d81d9e moved to https://github.com/redhat-openstack/puppet-pacemaker 52acfd9c31e0801cedf970929851d4bece5cf79b Merge pull request #33 from disconn3ct/master 2bd18523965c1b721837141b64f2aa7f31e3a99c Merge pull request #38 from RedHatEMEA/master f570bca0b1dec88ef2aa0c0b1a6ec369e174df48 Merge pull request #39 from cwolferh/constraint_exec_retry d03ff98b31b9c7d6d214f72b8099b25677cdf09a add retry capability for pacemaker::constraint::base c64dc8a8492981a0ff3a9d8b2f597bafa5be34a6 Remove inheritance from pacemaker::stonith of pacemaker::corosync e8c50396fe3dbc6f03d5a6bde4366036d437852d Merge pull request #37 from jistr/fence_agents_generation 1e052ddf4b1b47d3518e58e371a5de10aa68f60a XML sources and generated agent manifests 6757daf0c0df76c508ffb79b423e82c138d564f0 Agent manifest batch generation scripts 101168917ec7d5c80e9aee5fcd86dd420ae9c5c8 Generator of fence agent manifests 56bbb3580bb7fa62bf57c2ed7a30b938e42b8cc3 Merge pull request #35 from enovance/proper_password 1e94dc23a162cabbadb9e98d1c4fc48c75f8b39c pacemaker/corosync: Parametrize timeout values 5d91343c80f65b64be604f4a61558ff408c0f863 pacemaker/corosync: Grab correct hacluster password 55706c118b197b3f2c29035690ba85e644e0339a Fix route resource ID --- Puppetfile | 2 +- pacemaker/LICENSE | 201 ------------------ pacemaker/Modulefile | 13 -- pacemaker/README.md | 87 +------- .../provider/pcmk_constraint/default.rb | 64 ------ .../puppet/provider/pcmk_resource/default.rb | 156 -------------- pacemaker/lib/puppet/type/pcmk_constraint.rb | 26 --- pacemaker/lib/puppet/type/pcmk_resource.rb | 44 ---- pacemaker/manifests/constraint/base.pp | 65 ------ pacemaker/manifests/constraint/colocation.pp | 14 -- pacemaker/manifests/constraint/location.pp | 14 -- pacemaker/manifests/corosync.pp | 104 --------- pacemaker/manifests/init.pp | 38 ---- pacemaker/manifests/install.pp | 8 - pacemaker/manifests/params.pp | 26 --- pacemaker/manifests/resource/filesystem.pp | 26 --- pacemaker/manifests/resource/ip.pp | 23 -- pacemaker/manifests/resource/lsb.pp | 18 -- pacemaker/manifests/resource/mysql.pp | 30 --- pacemaker/manifests/resource/ocf.pp | 19 -- .../manifests/resource/qpid_clustered.pp | 52 ----- pacemaker/manifests/resource/route.pp | 41 ---- pacemaker/manifests/resource/service.pp | 19 -- pacemaker/manifests/resource/systemd.pp | 18 -- pacemaker/manifests/service.pp | 29 --- pacemaker/manifests/stonith.pp | 15 -- pacemaker/manifests/stonith/fence_xvm.pp | 57 ----- pacemaker/manifests/stonith/ipmilan.pp | 38 ---- pacemaker/spec/spec_helper.rb | 17 -- pacemaker/tests/init.pp | 88 -------- 30 files changed, 3 insertions(+), 1349 deletions(-) delete mode 100644 pacemaker/LICENSE delete mode 100644 pacemaker/Modulefile delete mode 100644 pacemaker/lib/puppet/provider/pcmk_constraint/default.rb delete mode 100644 pacemaker/lib/puppet/provider/pcmk_resource/default.rb delete mode 100644 pacemaker/lib/puppet/type/pcmk_constraint.rb delete mode 100644 pacemaker/lib/puppet/type/pcmk_resource.rb delete mode 100644 pacemaker/manifests/constraint/base.pp delete mode 100644 pacemaker/manifests/constraint/colocation.pp delete mode 100644 pacemaker/manifests/constraint/location.pp delete mode 100644 pacemaker/manifests/corosync.pp delete mode 100644 pacemaker/manifests/init.pp delete mode 100644 pacemaker/manifests/install.pp delete mode 100644 pacemaker/manifests/params.pp delete mode 100644 pacemaker/manifests/resource/filesystem.pp delete mode 100644 pacemaker/manifests/resource/ip.pp delete mode 100644 pacemaker/manifests/resource/lsb.pp delete mode 100644 pacemaker/manifests/resource/mysql.pp delete mode 100644 pacemaker/manifests/resource/ocf.pp delete mode 100644 pacemaker/manifests/resource/qpid_clustered.pp delete mode 100644 pacemaker/manifests/resource/route.pp delete mode 100644 pacemaker/manifests/resource/service.pp delete mode 100644 pacemaker/manifests/resource/systemd.pp delete mode 100644 pacemaker/manifests/service.pp delete mode 100644 pacemaker/manifests/stonith.pp delete mode 100644 pacemaker/manifests/stonith/fence_xvm.pp delete mode 100644 pacemaker/manifests/stonith/ipmilan.pp delete mode 100644 pacemaker/spec/spec_helper.rb delete mode 100644 pacemaker/tests/init.pp diff --git a/Puppetfile b/Puppetfile index 65f9af448..2324dc53e 100644 --- a/Puppetfile +++ b/Puppetfile @@ -111,7 +111,7 @@ mod 'openstacklib', :git => 'https://github.com/stackforge/puppet-openstacklib.git' mod 'pacemaker', - :commit => '0ed9ee8a29c0f27e86727d415b39d2715332df7d', + :commit => '01bc4942485abc3a8f46b055c8c8418ca9d81d9e', :git => 'https://github.com/radez/puppet-pacemaker.git' mod 'puppet', diff --git a/pacemaker/LICENSE b/pacemaker/LICENSE deleted file mode 100644 index 8d968b6cb..000000000 --- a/pacemaker/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. diff --git a/pacemaker/Modulefile b/pacemaker/Modulefile deleted file mode 100644 index 6c6cc6ac8..000000000 --- a/pacemaker/Modulefile +++ /dev/null @@ -1,13 +0,0 @@ -name 'radez-pacemaker' -version '0.2.0' -source 'https://github.com/radez/puppet-pacemaker' -author 'radez' -license 'Apache License, Version 2.0' -summary 'Puppet module to provide configuration managent of pacemaker and associated resources' -description 'Puppet module to provide configuration managent of pacemaker and associated resources' -project_page 'https://github.com/radez/puppet-pacemaker' - -## Add dependencies, if any: -# dependency 'username/name', '>= 1.2.0' -dependency 'puppetlabs/stdlib' -dependency 'puppetlabs/firewall' diff --git a/pacemaker/README.md b/pacemaker/README.md index 673f6d03b..c4682dcc5 100644 --- a/pacemaker/README.md +++ b/pacemaker/README.md @@ -1,87 +1,4 @@ # Pacemaker module for puppet -This module manages pacemaker on Linux distros with the pcs tool. - -## License -Apache 2.0 - -## Support & Contact -Please log tickets and issues at https://github.com/radez/puppet-pacemaker - -## Description - -This module uses the fact osfamily which is supported by Facter 1.6.1+. If you do not have facter 1.6.1 in your environment, the following manifests will provide the same functionality in site.pp (before declaring any node): - - if ! $::osfamily { - case $::operatingsystem { - 'RedHat', 'Fedora', 'CentOS', 'Scientific', 'SLC', 'Ascendos', 'CloudLinux', 'PSBM', 'OracleLinux', 'OVS', 'OEL': { - $osfamily = 'RedHat' - } - 'ubuntu', 'debian': { - $osfamily = 'Debian' - } - 'SLES', 'SLED', 'OpenSuSE', 'SuSE': { - $osfamily = 'Suse' - } - 'Solaris', 'Nexenta': { - $osfamily = 'Solaris' - } - default: { - $osfamily = $::operatingsystem - } - } - } - -This module is based on work by Dan Radez - -## Usage - -### pacemaker -Installs Pacemaker and corosync and creates a cluster - - class {"pacemaker::corosync": - cluster_name => "cluster_name", - cluster_members => "192.168.122.3 192.168.122.7", - } - -The pacemaker::corosync resource must be executed on each node - -### Disable stonith - class {"pacemaker::stonith": - disable => true, - } - -### Add a stonith device - class {"pacemaker::stonith::ipmilan": - address => "10.10.10.100", - user => "admin", - password => "admin", - } - -### Resources -Any of the following resources support a group propery. -This will create the group, if the group doesn't exist, -and add the resource to the group. This has been demonstrated -on the ip address example, but is not a required propery. - -#### Add a floating ip - pacemaker::resource::ip { "192.168.122.223": - ip_address => "192.168.122.223", - group => "my_group", - } - -#### Manage a Linux Standard Build service -#### That will get created after the floating ip - pacemaker::resource::lsb { "http": - require => Pacemaker::Resource::Ip['192.168.122.223'], - } - -#### Manage a MySQL server - pacemaker::resource::mysql { "da-database": } - -#### Manage a shared filesystem - pacemaker::resource::filesystem { "apache share": - device => "192.168.122.1:/var/www/html", - directory => "/mnt", - fstype => "nfs", - } +This module's home has been moved to +https://github.com/redhat-openstack/puppet-pacemaker diff --git a/pacemaker/lib/puppet/provider/pcmk_constraint/default.rb b/pacemaker/lib/puppet/provider/pcmk_constraint/default.rb deleted file mode 100644 index 83902b720..000000000 --- a/pacemaker/lib/puppet/provider/pcmk_constraint/default.rb +++ /dev/null @@ -1,64 +0,0 @@ -Puppet::Type.type(:pcmk_constraint).provide(:default) do - desc 'A base constraint definition for a pacemaker constraint' - - ### overloaded methods - def create - case @resource[:constraint_type] - when :location - cmd = 'constraint location add ' + @resource[:name] + ' ' + @resource[:resource] + ' ' + @resource[:location] + ' ' + @resource[:score] - when :colocation - cmd = 'constraint colocation add ' + @resource[:resource] + ' with ' + @resource[:location] + ' ' + @resource[:score] - else - fail(String(@resource[:constraint_type]) + ' is an invalid location type') - end - - # do pcs create - pcs('create constraint', cmd) - end - - def destroy - case @resource[:constraint_type] - when :location - cmd = 'constraint location remove ' + @resource[:name] - when :colocation - cmd = 'constraint colocation remove ' + @resource[:resource] + ' ' + @resource[:location] - end - - pcs('constraint delete', cmd) - end - - def exists? - cmd = 'constraint ' + String(@resource[:constraint_type]) + ' show --full' - pcs_out = pcs('show', cmd) - - # find the constraint - for line in pcs_out.lines.each do - case @resource[:constraint_type] - when :location - return true if line.include? @resource[:name] - when :colocation - return true if line.include? @resource[:resource] + ' with ' + @resource[:location] - end - end - # return false if constraint not found - false - end - - private - - def pcs(name, cmd) - pcs_out = `/usr/sbin/pcs #{cmd}` - #puts name - #puts $?.exitstatus - #puts pcs_out - if $?.exitstatus != 0 and not name.include? 'show' - if pcs_out.lines.first - raise Puppet::Error, "pcs #{name} failed: #{pcs_out.lines.first.chomp!}" if $?.exitstatus - else - raise Puppet::Error, "pcs #{name} failed" if $?.exitstatus - end - end - # return output for good exit or false for failure. - $?.exitstatus == 0 ? pcs_out : false - end -end diff --git a/pacemaker/lib/puppet/provider/pcmk_resource/default.rb b/pacemaker/lib/puppet/provider/pcmk_resource/default.rb deleted file mode 100644 index 7d3248fa6..000000000 --- a/pacemaker/lib/puppet/provider/pcmk_resource/default.rb +++ /dev/null @@ -1,156 +0,0 @@ -Puppet::Type.type(:pcmk_resource).provide(:default) do - desc 'A base resource definition for a pacemaker resource' - - ### overloaded methods - def create - cmd = 'resource create ' + @resource[:name] + ' ' + @resource[:resource_type] + ' ' + @resource[:resource_params] + ' op monitor interval=' + @resource[:interval] - if @resource[:monitor_params] and not @resource[:monitor_params].empty? - cmd += hash_to_params(@resource[:monitor_params]) - end - # group defaults to empty - if not @resource[:group].empty? - cmd += ' --group ' + @resource[:group] - end - # clone defaults to false - if @resource[:clone] - cmd += ' --clone' - end - # do pcs create - pcs('create', cmd) - end - - def destroy - cmd = 'resource delete ' + @resource[:name] - pcs('delete', cmd) - end - - def exists? - cmd = 'resource show ' + @resource[:name] + ' > /dev/null 2>&1' - pcs('show', cmd) - end - - - ### property methods - def resource_params - cmd = 'resource show ' + @resource[:name] - get_attrs = pcs('get interval', cmd) - - # find the Attributes - for line in get_attrs.lines.each do - return (line.scan /Attributes: (.+?)$/m)[0][0].strip if line.include? 'Attributes:' - end - # return empty string if Attributes not found - '' - end - - def resource_params=(value) - cmd = 'resource update ' + @resource[:name] + ' ' + value - pcs('update attributes', cmd) - end - - def group - # get the list of groups and their resources - cmd = 'resource --groups' - resource_groups = pcs('group list', cmd) - - # find the group that has the resource in it - for group in resource_groups.lines.each do - return group[0, /:/ =~ group] if group.include? @resource[:name] - end - # return empty string if a group wasn't found - # that includes the resource in it. - '' - end - - def group=(value) - if value.empty? - cmd = 'resource ungroup ' + group + ' ' + @resource[:name] - pcs('ungroup', cmd) - else - cmd = 'resource group add ' + value + ' ' + @resource[:name] - pcs('group add', cmd) - end - end - - def clone - cmd = 'resource show ' + @resource[:name] + '-clone > /dev/null 2>&1' - pcs('show clone', cmd) == false ? false : true - end - - def clone=(value) - if not value - cmd = 'resource unclone ' + @resource[:name] - pcs('unclone', cmd) - else - cmd = 'resource clone ' + @resource[:name] - pcs('clone', cmd) - end - end - - def interval - cmd = 'resource show ' + @resource[:name] - get_interval = pcs('get interval', cmd) - - # find the interval value - for line in get_interval.lines.each do - return (line.scan /interval=(.+?) /m)[0][0] if line.include? 'interval=' - end - # return empty string if an interval value wasn't found - '' - end - - def interval=(value) - cmd = 'resource update ' + @resource[:name] + ' op monitor interval=' + value - pcs('update interval', cmd) - end - - def monitor_params - cmd = 'resource show ' + @resource[:name] - pcs_output = pcs('get monitor params', cmd) - - pcs_output.each_line do |line| - line.strip.match(/(Operations: )?monitor ([^(]+)/) do |match| - Puppet.debug(match.inspect) - return params_to_hash(match[2]) - end - end - # return empty string if monitor params not found - '' - end - - def monitor_params=(value) - cmd = 'resource update ' + @resource[:name] + ' op monitor ' + hash_to_params(value) - pcs('update interval', cmd) - end - - private - - def pcs(name, cmd) - Puppet.debug("/usr/sbin/pcs #{cmd}") - pcs_out = `/usr/sbin/pcs #{cmd}` - #puts name - #puts $?.exitstatus - if $?.exitstatus != 0 and pcs_out.lines.first and not name.include? 'show' - Puppet.debug("Error: #{pcs_out}") - raise Puppet::Error, "pcs #{name} failed: #{pcs_out.lines.first.chomp!}" if $?.exitstatus - end - # return output for good exit or false for failure. - $?.exitstatus == 0 ? pcs_out : false - end - - def params_to_hash(str) - str.split.reduce({}) do |hash, param| - k,v = param.split '=' - hash[k] = v - hash - end - end - - def hash_to_params(hash) - params = '' - hash.each_pair do |k,v| - params += " #{k}=#{v}" - end - params - end -end diff --git a/pacemaker/lib/puppet/type/pcmk_constraint.rb b/pacemaker/lib/puppet/type/pcmk_constraint.rb deleted file mode 100644 index 96250d83d..000000000 --- a/pacemaker/lib/puppet/type/pcmk_constraint.rb +++ /dev/null @@ -1,26 +0,0 @@ -Puppet::Type.newtype(:pcmk_constraint) do - @doc = "Base constraint definition for a pacemaker constraint" - - ensurable - - newparam(:name) do - desc "A unique name for the constraint" - end - - newparam(:constraint_type) do - desc "the pacemaker type to create" - newvalues(:location, :colocation) - end - newparam(:resource) do - desc "resource list" - newvalues(/.+/) - end - newparam(:location) do - desc "location" - newvalues(/.+/) - end - newparam(:score) do - desc "Score" - end - -end diff --git a/pacemaker/lib/puppet/type/pcmk_resource.rb b/pacemaker/lib/puppet/type/pcmk_resource.rb deleted file mode 100644 index 192338a3b..000000000 --- a/pacemaker/lib/puppet/type/pcmk_resource.rb +++ /dev/null @@ -1,44 +0,0 @@ -Puppet::Type.newtype(:pcmk_resource) do - @doc = "Base resource definition for a pacemaker resource" - - ensurable - - newparam(:name) do - desc "A unique name for the resource" - end - - newparam(:resource_type) do - desc "the pacemaker type to create" - end - newproperty(:resource_params) do - desc "extra parameters to the retource group" - end - newproperty(:group) do - desc "A resource group to put the resource in" - end - newproperty(:clone) do - desc "set if this is a cloned resource" - defaultto false - end - newproperty(:interval) do - desc "resource check interval" - defaultto "30s" - end - newproperty(:monitor_params) do - desc "extra parameters for monitor operation" - - validate do |value| - unless value.is_a? Hash - raise ArgumentError, "monitor_params must be a hash, not #{value.inspect}" - end - end - - munge do |value| - if resource.parameters[:interval].value - value.merge!({'interval' => resource.parameters[:interval].value}) - else - value - end - end - end -end diff --git a/pacemaker/manifests/constraint/base.pp b/pacemaker/manifests/constraint/base.pp deleted file mode 100644 index f93e28d21..000000000 --- a/pacemaker/manifests/constraint/base.pp +++ /dev/null @@ -1,65 +0,0 @@ -define pacemaker::constraint::base ($constraint_type, - $first_resource, - $second_resource=undef, - $first_action=undef, - $second_action=undef, - $location=undef, - $score=undef, - $ensure=present) { - - validate_re($constraint_type, ['colocation', 'order', 'location']) - - if($constraint_type == 'order' and ($first_action == undef or $second_action == undef)) { - fail("Must provide actions when constraint type is order") - } - - if($constraint_type == 'location' and $location == undef) { - fail("Must provide location when constraint type is location") - } - - if($constraint_type == 'location' and $score == undef) { - fail("Must provide score when constraint type is location") - } - - if($ensure == absent) { - if($constraint_type == 'location') { - exec { "Removing location constraint ${name}": - command => "/usr/sbin/pcs constraint location remove ${name}", - onlyif => "/usr/sbin/pcs constraint location show --full | grep ${name}", - require => Exec["wait-for-settle"], - } - } else { - exec { "Removing ${constraint_type} constraint ${name}": - command => "/usr/sbin/pcs constraint ${constraint_type} remove ${first_resource} ${second_resource}", - onlyif => "/usr/sbin/pcs constraint ${constraint_type} show | grep ${first_resource} | grep ${second_resource}", - require => Exec["wait-for-settle"], - } - } - } else { - case $constraint_type { - 'colocation': { - fail("Deprecated use pacemaker::constraint::colocation") - exec { "Creating colocation constraint ${name}": - command => "/usr/sbin/pcs constraint colocation add ${first_resource} ${second_resource} ${score}", - unless => "/usr/sbin/pcs constraint colocation show | grep ${first_resource} | grep ${second_resource} > /dev/null 2>&1", - require => [Exec["wait-for-settle"],Package["pcs"]], - } - } - 'order': { - exec { "Creating order constraint ${name}": - command => "/usr/sbin/pcs constraint order ${first_action} ${first_resource} then ${second_action} ${second_resource}", - unless => "/usr/sbin/pcs constraint order show | grep ${first_resource} | grep ${second_resource} > /dev/null 2>&1", - require => [Exec["wait-for-settle"],Package["pcs"]], - } - } - 'location': { - fail("Deprecated use pacemaker::constraint::location") - exec { "Creating location constraint ${name}": - command => "/usr/sbin/pcs constraint location add ${name} ${first_resource} ${location} ${score}", - unless => "/usr/sbin/pcs constraint location show | grep ${first_resource} > /dev/null 2>&1", - require => [Exec["wait-for-settle"],Package["pcs"]], - } - } - } - } -} diff --git a/pacemaker/manifests/constraint/colocation.pp b/pacemaker/manifests/constraint/colocation.pp deleted file mode 100644 index c679c00e8..000000000 --- a/pacemaker/manifests/constraint/colocation.pp +++ /dev/null @@ -1,14 +0,0 @@ -define pacemaker::constraint::colocation ($source, - $target, - $score, - $ensure=present) { - pcmk_constraint {"colo-$source-$target": - constraint_type => colocation, - resource => $source, - location => $target, - score => $score, - ensure => $ensure, - require => Exec["wait-for-settle"], - } -} - diff --git a/pacemaker/manifests/constraint/location.pp b/pacemaker/manifests/constraint/location.pp deleted file mode 100644 index 3295bfacc..000000000 --- a/pacemaker/manifests/constraint/location.pp +++ /dev/null @@ -1,14 +0,0 @@ -define pacemaker::constraint::location ($resource, - $location, - $score, - $ensure='present') { - pcmk_constraint {"loc-$resource-$location": - constraint_type => location, - resource => $resource, - location => $location, - score => $score, - ensure => $ensure, - require => Exec["wait-for-settle"], - } -} - diff --git a/pacemaker/manifests/corosync.pp b/pacemaker/manifests/corosync.pp deleted file mode 100644 index ae4e0638f..000000000 --- a/pacemaker/manifests/corosync.pp +++ /dev/null @@ -1,104 +0,0 @@ -# == Class: pacemaker::corosync -# -# A class to setup a pacemaker cluster -# -# === Parameters -# [*cluster_name*] -# The name of the cluster (no whitespace) -# [*cluster_members*] -# A space-separted list of cluster IP's or names -# [*setup_cluster*] -# If your cluster includes pcsd, this should be set to true for just -# one node in cluster. Else set to true for all nodes. -# [*manage_fw*] -# Manage or not IPtables rules. -# [*settle_timeout*] -# Timeout to wait for settle. -# [*settle_tries*] -# Number of tries for settle. -# [*settle_try_sleep*] -# Time to sleep after each seetle try. - -class pacemaker::corosync( - $cluster_members, - $cluster_name = 'clustername', - $setup_cluster = true, - $manage_fw = true, - $settle_timeout = '3600', - $settle_tries = '360', - $settle_try_sleep = '10', -) inherits pacemaker { - include ::pacemaker::params - - if $manage_fw { - firewall { '001 corosync mcast': - proto => 'udp', - dport => ['5404', '5405'], - action => 'accept', - } - } - - if $pcsd_mode { - if $manage_fw { - firewall { '001 pcsd': - proto => 'tcp', - dport => ['2224'], - action => 'accept', - } - } - Service['pcsd'] -> - # we have more fragile when-to-start pacemaker conditions with pcsd - exec {"enable-not-start-$cluster_name": - command => "/usr/sbin/pcs cluster enable" - } - -> - exec {"Set password for hacluster user on $cluster_name": - command => "/bin/echo ${::pacemaker::params::hacluster_pwd} | /usr/bin/passwd --stdin hacluster", - creates => "/etc/cluster/cluster.conf", - require => Class["::pacemaker::install"], - } - -> - exec {"auth-successful-across-all-nodes": - command => "/usr/sbin/pcs cluster auth $cluster_members -u hacluster -p ${::pacemaker::params::hacluster_pwd} --force", - timeout => 3600, - tries => 360, - try_sleep => 10, - } - -> - Exec["wait-for-settle"] - } - - if $setup_cluster { - exec {"Create Cluster $cluster_name": - creates => "/etc/cluster/cluster.conf", - command => "/usr/sbin/pcs cluster setup --name $cluster_name $cluster_members", - unless => "/usr/bin/test -f /etc/corosync/corosync.conf", - require => Class["::pacemaker::install"], - } - -> - exec {"Start Cluster $cluster_name": - unless => "/usr/sbin/pcs status >/dev/null 2>&1", - command => "/usr/sbin/pcs cluster start --all", - require => Exec["Create Cluster $cluster_name"], - } - if $pcsd_mode { - Exec["auth-successful-across-all-nodes"] -> - Exec["Create Cluster $cluster_name"] - } - Exec["Start Cluster $cluster_name"] -> - Exec["wait-for-settle"] - } - - exec {"wait-for-settle": - timeout => $settle_timeout, - tries => $settle_tries, - try_sleep => $settle_try_sleep, - command => "/usr/sbin/pcs status | grep -q 'partition with quorum' > /dev/null 2>&1", - unless => "/usr/sbin/pcs status | grep -q 'partition with quorum' > /dev/null 2>&1", - notify => Notify["pacemaker settled"], - } - - notify {"pacemaker settled": - message => "Pacemaker has reported quorum achieved", - } -} diff --git a/pacemaker/manifests/init.pp b/pacemaker/manifests/init.pp deleted file mode 100644 index bdd5809fa..000000000 --- a/pacemaker/manifests/init.pp +++ /dev/null @@ -1,38 +0,0 @@ -# == Class: pacemaker -# -# base class for pacemaker -# -# === Parameters -# -# [*pacemaker::params::hacluster_pwd*] -# String, used as the default for the pacemaker hacluster_pwd variable -# Default: CHANGEME -# -# === Variables -# -# [*hacluster_pwd*] -# used to set the password for the hacluster user on the nodes -# this user will be used in future pacemaker releases for pcsd to -# communicate between nodes. -# Default: $pacemaker::params::hacluster_pwd -# -# === Examples -# -# see pacemaker::corosync -# -# === Authors -# -# Dan Radez -# -# === Copyright -# -# Copyright 2013 Red Hat Inc. -# - -class pacemaker( - $hacluster_pwd = $pacemaker::params::hacluster_pwd -) inherits pacemaker::params { - include ::pacemaker::params - include ::pacemaker::install - include ::pacemaker::service -} diff --git a/pacemaker/manifests/install.pp b/pacemaker/manifests/install.pp deleted file mode 100644 index 37d88c906..000000000 --- a/pacemaker/manifests/install.pp +++ /dev/null @@ -1,8 +0,0 @@ -class pacemaker::install ( - $ensure = present, -) { - include pacemaker::params - package { $pacemaker::params::package_list: - ensure => $ensure, - } -} diff --git a/pacemaker/manifests/params.pp b/pacemaker/manifests/params.pp deleted file mode 100644 index 4a212799b..000000000 --- a/pacemaker/manifests/params.pp +++ /dev/null @@ -1,26 +0,0 @@ -class pacemaker::params { - - $hacluster_pwd = 'CHANGEME' - case $::osfamily { - redhat: { - if $::operatingsystemrelease =~ /^6\..*$/ { - $package_list = ["pacemaker","pcs","fence-agents","cman"] - # TODO in el6.6, $pcsd_mode should be true - $pcsd_mode = false - $services_manager = 'lsb' - } else { - $package_list = ["pacemaker","pcs","fence-agents-all"] - $pcsd_mode = true - $services_manager = 'systemd' - } - $service_name = 'pacemaker' - } - default: { - case $::operatingsystem { - default: { - fail("Unsupported platform: ${::osfamily}/${::operatingsystem}") - } - } - } - } -} diff --git a/pacemaker/manifests/resource/filesystem.pp b/pacemaker/manifests/resource/filesystem.pp deleted file mode 100644 index c89740916..000000000 --- a/pacemaker/manifests/resource/filesystem.pp +++ /dev/null @@ -1,26 +0,0 @@ -define pacemaker::resource::filesystem($device, - $directory, - $fsoptions='', - $fstype, - $group='', - $clone=false, - $interval='30s', - $monitor_params=undef, - $ensure='present') { - $resource_id = delete("fs-${directory}", '/') - - $resource_params = $fsoptions ? { - '' => "device=${device} directory=${directory} fstype=${fstype}", - default => "device=${device} directory=${directory} fstype=${fstype} options=\"${fsoptions}\"", - } - - pcmk_resource { $resource_id: - resource_type => 'Filesystem', - resource_params => $resource_params, - group => $group, - clone => $clone, - interval => $interval, - monitor_params => $monitor_params, - ensure => $ensure, - } -} diff --git a/pacemaker/manifests/resource/ip.pp b/pacemaker/manifests/resource/ip.pp deleted file mode 100644 index 282e4bf51..000000000 --- a/pacemaker/manifests/resource/ip.pp +++ /dev/null @@ -1,23 +0,0 @@ -define pacemaker::resource::ip($ip_address, - $cidr_netmask=32, - $nic='', - $group='', - $interval='30s', - $monitor_params=undef, - $ensure='present') { - - $nic_option = $nic ? { - '' => '', - default => " nic=$nic" - } - - pcmk_resource { "ip-${ip_address}": - ensure => $ensure, - resource_type => 'IPaddr2', - resource_params => "ip=${ip_address} cidr_netmask=${cidr_netmask}${nic_option}", - group => $group, - interval => $interval, - monitor_params => $monitor_params, - } - -} diff --git a/pacemaker/manifests/resource/lsb.pp b/pacemaker/manifests/resource/lsb.pp deleted file mode 100644 index a3894ef34..000000000 --- a/pacemaker/manifests/resource/lsb.pp +++ /dev/null @@ -1,18 +0,0 @@ -define pacemaker::resource::lsb($group='', - $clone=false, - $interval='30s', - $monitor_params=undef, - $ensure='present', - $options='') { - - pcmk_resource { "${name}": - ensure => $ensure, - resource_type => "lsb:${name}", - resource_params => $options, - group => $group, - clone => $clone, - interval => $interval, - monitor_params => $monitor_params, - } - -} diff --git a/pacemaker/manifests/resource/mysql.pp b/pacemaker/manifests/resource/mysql.pp deleted file mode 100644 index 4e1898f6e..000000000 --- a/pacemaker/manifests/resource/mysql.pp +++ /dev/null @@ -1,30 +0,0 @@ -define pacemaker::resource::mysql($name, - $group='', - $clone=false, - $interval='30s', - $monitor_params=undef, - $stickiness=0, - $ensure='present', - $additional_params='', - $replication_user='', - $replication_passwd='', - $max_slave_lag=0, - $evict_outdated_slaves=false, - $enable_creation=true) { - - $replication_options = $replication_user ? { - '' => '', - default => " replication_user=$replication_user replication_passwd=$replication_passwd max_slave_lag=$max_slave_lag evict_outdated_slaves=$evict_outdated_slaves" - } - - pcmk_resource { "mysql-${name}": - resource_type => 'mysql', - resource_params => "enable_creation=${enable_creation}${replication_options} ${additional_params}", - group => $group, - clone => $clone, - interval => $interval, - monitor_params => $monitor_params, - ensure => $ensure, - } - -} diff --git a/pacemaker/manifests/resource/ocf.pp b/pacemaker/manifests/resource/ocf.pp deleted file mode 100644 index 6bd0395e0..000000000 --- a/pacemaker/manifests/resource/ocf.pp +++ /dev/null @@ -1,19 +0,0 @@ -define pacemaker::resource::ocf($group='', - $clone=false, - $interval='30s', - $monitor_params=undef, - $ensure='present', - $options='', - $resource_name='') { - - pcmk_resource { "${name}": - ensure => $ensure, - resource_type => "ocf:${resource_name}", - resource_params => $options, - group => $group, - clone => $clone, - interval => $interval, - monitor_params => $monitor_params, - } - -} diff --git a/pacemaker/manifests/resource/qpid_clustered.pp b/pacemaker/manifests/resource/qpid_clustered.pp deleted file mode 100644 index 18ce8a1fc..000000000 --- a/pacemaker/manifests/resource/qpid_clustered.pp +++ /dev/null @@ -1,52 +0,0 @@ -# This class should be included on all nodes that are -# part of a qpid cluster -# It ensures that the qpid cluster package is installed -# and that the nessesary configs are inplace for -# the qpid clustering to start using the pacemaker -# corosync instance -# The pacemaker resource is created as a cloned resource -# so that pacemaker starts qpid on all the cluster's nodes - -define pacemaker::resource::qpid_clustered($name, - $cluster_name, - $clone=true, - $group='', - $interval='30s', - $monitor_params=undef, - $stickiness=0, - $ensure='present') { - - package { "qpid-cpp-server-cluster": - ensure => installed, - } - - file_line { 'Set Qpid Cluster Name': - path => '/etc/qpidd.conf', - match => '^[ ]*cluster_name=', - line => "cluster_name='${cluster_name}'", - } - - # TODO: this should be replaced with an exec once - # https://bugzilla.redhat.com/show_bug.cgi?id=1019368 - # has been completed - augeas { "uidgid in cluster.conf": - lens => "Xml.lns", - incl => "/etc/cluster/cluster.conf", - changes => [ - "set cluster/uidgid/#attribute/uid qpidd", - "set cluster/uidgid/#attribute/gid qpidd", - ], - require => Package['qpid-cpp-server-cluster'], - } - - pcmk_resource { "lsb-qpidd": - resource_type => "lsb:qpidd", - resource_params => "", - group => $group, - clone => $clone, - interval => $interval, - monitor_params => $monitor_params, - ensure => $ensure, - } - -} diff --git a/pacemaker/manifests/resource/route.pp b/pacemaker/manifests/resource/route.pp deleted file mode 100644 index 106924108..000000000 --- a/pacemaker/manifests/resource/route.pp +++ /dev/null @@ -1,41 +0,0 @@ -define pacemaker::resource::route($src='', - $dest='', - $gateway='', - $nic='', - $clone= false, - $group='', - $interval='30s', - $monitor_params=undef, - $ensure='present') { - - $nic_option = $nic ? { - '' => '', - default => " device=$nic" - } - - $src_option = $src ? { - '' => '', - default => " source=$src" - } - - $dest_option = $dest ? { - '' => '', - default => " destination=$dest" - } - - $gw_option = $gateway ? { - '' => '', - default => " gateway=$gateway" - } - - pcmk_resource { "route-${src}-${dest}-${gateway}-${group}": - ensure => $ensure, - resource_type => 'Route', - resource_params => "${dest_option} ${src_option} ${nic_option} ${gw_option}", - group => $group, - interval => $interval, - monitor_params => $monitor_params, - clone => $clone, - } - -} diff --git a/pacemaker/manifests/resource/service.pp b/pacemaker/manifests/resource/service.pp deleted file mode 100644 index 15f9643b0..000000000 --- a/pacemaker/manifests/resource/service.pp +++ /dev/null @@ -1,19 +0,0 @@ -define pacemaker::resource::service($group='', - $clone=false, - $interval='30s', - $monitor_params=undef, - $ensure='present', - $options='') { - - include ::pacemaker::params - $res = "pacemaker::resource::${::pacemaker::params::services_manager}" - create_resources($res, - { "$name" => { group => $group, - clone => $clone, - interval => $interval, - monitor_params => $monitor_params, - ensure => $ensure, - options => $options, - } - }) -} diff --git a/pacemaker/manifests/resource/systemd.pp b/pacemaker/manifests/resource/systemd.pp deleted file mode 100644 index f24e2bf83..000000000 --- a/pacemaker/manifests/resource/systemd.pp +++ /dev/null @@ -1,18 +0,0 @@ -define pacemaker::resource::systemd($group='', - $clone=false, - $interval='30s', - $monitor_params=undef, - $ensure='present', - $options='') { - - pcmk_resource { "${name}": - ensure => $ensure, - resource_type => "systemd:${name}", - resource_params => $options, - group => $group, - clone => $clone, - interval => $interval, - monitor_params => $monitor_params, - } - -} diff --git a/pacemaker/manifests/service.pp b/pacemaker/manifests/service.pp deleted file mode 100644 index b2b636020..000000000 --- a/pacemaker/manifests/service.pp +++ /dev/null @@ -1,29 +0,0 @@ -class pacemaker::service ( - $ensure = running, - $hasstatus = true, - $hasrestart = true, - $enable = true, -) { - include ::pacemaker::params - - if $::pacemaker::params::pcsd_mode { - # only set up pcsd, not the other cluster services which have - # very specific setup and when-to-start-up requirements - # that are taken care of in corosync.pp - service { 'pcsd': - ensure => $ensure, - hasstatus => $hasstatus, - hasrestart => $hasrestart, - enable => $enable, - require => Class['::pacemaker::install'], - } - } else { - service { $::pacemaker::params::service_name: - ensure => $ensure, - hasstatus => $hasstatus, - hasrestart => $hasrestart, - enable => $enable, - require => Class['::pacemaker::install'], - } - } -} diff --git a/pacemaker/manifests/stonith.pp b/pacemaker/manifests/stonith.pp deleted file mode 100644 index 991872bde..000000000 --- a/pacemaker/manifests/stonith.pp +++ /dev/null @@ -1,15 +0,0 @@ -class pacemaker::stonith ($disable=true) inherits pacemaker::corosync { - if $disable == true { - exec {"Disable STONITH": - command => "/usr/sbin/pcs property set stonith-enabled=false", - unless => "/usr/sbin/pcs property show stonith-enabled | grep 'stonith-enabled: false'", - require => Exec["wait-for-settle"], - } - } else { - exec {"Enable STONITH": - command => "/usr/sbin/pcs property set stonith-enabled=true", - onlyif => "/usr/sbin/pcs property show stonith-enabled | grep 'stonith-enabled: false'", - require => Exec["wait-for-settle"], - } - } -} diff --git a/pacemaker/manifests/stonith/fence_xvm.pp b/pacemaker/manifests/stonith/fence_xvm.pp deleted file mode 100644 index bc59cc743..000000000 --- a/pacemaker/manifests/stonith/fence_xvm.pp +++ /dev/null @@ -1,57 +0,0 @@ -# To use this class ensure that fence_virtd is properly configured and running on the hypervisor - -class pacemaker::stonith::fence_xvm( - $name, - $manage_key_file=false, - $key_file="/etc/cluster/fence_xvm.key", - $key_file_password="123456", - $interval="30s", - $ensure=present, - $port=undef, # the name of the vm - $pcmk_host=undef, # the hostname or IP that pacemaker uses - $manage_fw = true, - ) { - if($ensure == absent) { - exec { "Removing stonith::fence_xvm ${name}": - command => "/usr/sbin/pcs stonith delete fence_xvm-${name }", - onlyif => "/usr/sbin/pcs stonith show fence_xvm-${name} > /dev/null 2>&1", - require => Class['pacemaker::corosync'], - } - } else { - $port_chunk = $port ? { - '' => '', - default => "port=${port}", - } - $pcmk_host_list_chunk = $pcmk_host ? { - '' => 'pcmk_host_list=$(/usr/sbin/crm_node -n)', - default => "pcmk_host_list=${pcmk_host}", - } - if $manage_key_file { - file { "$key_file": - content => "$key_file_password", - } - } - if $manage_fw { - firewall { "003 fence_xvm": - proto => 'igmp', - action => 'accept', - } - firewall { "004 fence_xvm": - proto => 'udp', - dport => '1229', - action => 'accept', - } - firewall { "005 fence_xvm": - proto => 'tcp', - dport => '1229', - action => 'accept', - } - } - - exec { "Creating stonith::fence_xvm ${name}": - command => "/usr/sbin/pcs stonith create fence_xvm-${name} fence_xvm ${port_chunk} ${pcmk_host_list_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show fence_xvm-${name} > /dev/null 2>&1", - require => Class['pacemaker::corosync'], - } - } -} diff --git a/pacemaker/manifests/stonith/ipmilan.pp b/pacemaker/manifests/stonith/ipmilan.pp deleted file mode 100644 index 4f0becf55..000000000 --- a/pacemaker/manifests/stonith/ipmilan.pp +++ /dev/null @@ -1,38 +0,0 @@ -class pacemaker::stonith::ipmilan( - $address ="10.10.10.1", - $username ="", - $password ="", - $interval ="60s", - $ensure ="present", - $pcmk_host_list ="", - ) { - if($ensure == absent) { - exec { "Removing stonith::ipmilan ${address}": - command => "/usr/sbin/pcs stonith delete stonith-ipmilan-${address}", - onlyif => "/usr/sbin/pcs stonith show stonith-ipmilan-${address} > /dev/null 2>&1", - require => Class['pacemaker::corosync'], - } - } else { - $username_chunk = $username ? { - '' => '', - default => "login=${username}", - } - $password_chunk = $password ? { - '' => '', - default => "passwd=${password}", - } - $pcmk_host_list_chunk = $pcmk_host_list ? { - '' => '', - default => "pcmk_host_list=\"${pcmk_host_list}\"", - } - - package { "ipmitool": - ensure => installed, - } -> - exec { "Creating stonith::ipmilan ${address}": - command => "/usr/sbin/pcs stonith create stonith-ipmilan-${address} fence_ipmilan ${pcmk_host_list_chunk} ipaddr=${address} ${username_chunk} ${password_chunk} op monitor interval=${interval}", - unless => "/usr/sbin/pcs stonith show stonith-ipmilan-${address} > /dev/null 2>&1", - require => Class['pacemaker::corosync'], - } - } -} diff --git a/pacemaker/spec/spec_helper.rb b/pacemaker/spec/spec_helper.rb deleted file mode 100644 index 5fda58875..000000000 --- a/pacemaker/spec/spec_helper.rb +++ /dev/null @@ -1,17 +0,0 @@ -dir = File.expand_path(File.dirname(__FILE__)) -$LOAD_PATH.unshift File.join(dir, 'lib') - -require 'mocha' -require 'puppet' -require 'rspec' -require 'spec/autorun' - -Spec::Runner.configure do |config| - config.mock_with :mocha -end - -# We need this because the RAL uses 'should' as a method. This -# allows us the same behaviour but with a different method name. -class Object - alias :must :should -end diff --git a/pacemaker/tests/init.pp b/pacemaker/tests/init.pp deleted file mode 100644 index c837e17f5..000000000 --- a/pacemaker/tests/init.pp +++ /dev/null @@ -1,88 +0,0 @@ -# The baseline for module testing used by Puppet Labs is that each manifest -# should have a corresponding test manifest that declares that class or defined -# type. -# -# Tests are then run by using puppet apply --noop (to check for compilation errors -# and view a log of events) or by fully applying the test in a virtual environment -# (to compare the resulting system state to the desired state). -# -# Learn more about module testing here: http://docs.puppetlabs.com/guides/tests_smoke.html -# -include pacemaker - -### Installs Pacemaker and corosync and creates a cluster -### Should be run on all pacemaker nodes -class {"pacemaker::corosync": - cluster_name => "cluster_name", - cluster_members => "192.168.122.3 192.168.122.7", -} - -### Disable stonith -class {"pacemaker::stonith": - disable => true, -} - -### Add a stonith device -class {"pacemaker::stonith::ipmilan": - address => "192.168.122.103", - user => "admin", - password => "admin", -} - -### Add resources -### each of these can generally be added to a single -### node, though running them on multiple nodes -### will net the same result -class {"pacemaker::resource::ip": - ip_address => "192.168.122.223", - #ensure => "absent", - group => 'test-group', -} - -class {"pacemaker::resource::lsb": - name => "httpd", - #ensure => "absent", - group => 'test-group', -} - -class {"pacemaker::resource::mysql": - name => "my-mysqld", - group => 'test-group', - #ensure => "absent", - #enable_creation => false, -} - -class {"pacemaker::resource::filesystem": - device => "192.168.122.1:/var/www/html", - directory => "/mnt", - fstype => "nfs", - group => 'test-group', -} - -# this must be run on all pacemaker/qpidd nodes -class {'pacemaker::resource::qpid': - name => "My_qpidd_resource", - cluster_name => "qpid_cluster", -} - -### Add constraints -pacemaker::constraint::base { "ip-192.168.122.223_with_fs-mnt": - constraint_type => 'colocation', - first_resource => 'ip-192.168.122.223', - second_resource => 'fs-mnt', -} - -pacemaker::constraint::base { "ip-192.168.122.223_before_fs-mnt": - constraint_type => 'order', - first_resource => 'ip-192.168.122.223', - second_resource => 'fs-mnt', - first_action => 'start', - second_action => 'start', -} - -pacemaker::constraint::base { "ip-192.168.122.223_on_192.168.122.3": - constraint_type => 'location', - first_resource => 'ip-192.168.122.223', - location => '192.168.122.3', - score => 'INFINITY', -}