-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
94b3eb4
commit eee4b74
Showing
15 changed files
with
530 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.vagrant | ||
Berksfile.lock | ||
.kitchen/ | ||
.kitchen.local.yml | ||
Thumbs.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# (C) Copyright IBM Corporation 2016. | ||
# | ||
# 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. | ||
--- | ||
driver: | ||
name: vagrant | ||
|
||
provisioner: | ||
name: chef_zero | ||
|
||
verifier: | ||
name: inspec | ||
|
||
platforms: | ||
- name: ubuntu-14.04-chef-latest | ||
provisioner: | ||
require_chef_omnibus: 12.6.0 | ||
driver: | ||
box: opscode-ubuntu-14.04 | ||
|
||
suites: | ||
- name: goodpath | ||
attributes: | ||
ibm_mq_test: | ||
# You need to set up a web server with the MQ packages on for the | ||
# tests to use, and reference the full URI as an environment variable. | ||
source: "<%= ENV['MQ_URI'] %>" | ||
queue_manager: | ||
name: qm1 | ||
run_list: | ||
- recipe[apt::default] | ||
- recipe[ibm_mq_test::install] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
source 'https://supermarket.chef.io' | ||
|
||
metadata | ||
|
||
group :integration do | ||
cookbook 'apt' | ||
cookbook 'ibm_mq_test', path: 'test/cookbooks/ibm_mq_test' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
IBM Contributor License Agreement | ||
================================= | ||
|
||
Version 1.0.0 January 14, 2014 | ||
|
||
In order for You (as defined below) to make intellectual property Contributions (as defined below) now or in the future to IBM GitHub repositories, | ||
You must agree to this Contributor License Agreement ("CLA"). | ||
|
||
Please read this CLA carefully before accepting its terms. By accepting the CLA, You are agreeing to be bound by its terms. | ||
If You submit a Pull Request against an IBM repository on GitHub You must include in the Pull Request a statement of Your acceptance of this CLA. | ||
|
||
As used in this CLA: | ||
(i) "You" (or "Your") shall mean the entity that is making this Agreement with IBM; | ||
(ii)"Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is submitted by You to IBM for inclusion in, | ||
or documentation of, any of the IBM GitHub repositories; | ||
(iii) "Submit" (or "Submitted") means any form of communication sent to IBM (e.g. the content You post in a GitHub Issue or submit as part of a GitHub Pull Request). | ||
|
||
This agreement applies to all Contributions You Submit. | ||
|
||
This CLA, and the license(s) associated with the particular IBM GitHub repositories You are contributing to, provides a license to Your Contributions to IBM and downstream consumers, | ||
but You still own Your Contributions, and except for the licenses provided for in this CLA, You reserve all right, title and interest in Your Contributions. | ||
|
||
IBM requires that each Contribution You Submit now or in the future comply with the following four commitments. | ||
|
||
1) You will only Submit Contributions where You have authored 100% of the content. | ||
2) You will only Submit Contributions to which You have the necessary rights. This means that if You are employed You have received the necessary permissions from Your employer to make the | ||
Contributions. | ||
3) Whatever content You Contribute will be provided under the license(s) associated with the particular IBM GitHub repository You are contributing to. | ||
4) You understand and agree that IBM GitHub repositories and Your contributions are public, and that a record of the contribution (including all personal information You submit with it) | ||
is maintained indefinitely and may be redistributed consistent with the license(s) involved. | ||
You will promptly notify IBM if You become aware of any facts or circumstances that would make these commitments inaccurate in any way. | ||
To do so, please create an Issue in the appropriate GitHub repository. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
IBM MQ cookbook | ||
=============== | ||
|
||
The IBM MQ cookbook is a library cookbook that provides custom resources for use in your own recipes. This cookbook is currently experimental, therefore we recommend that if you want to use this cookbook, that you either pin the version you use, or create your own fork first. | ||
|
||
Requirements | ||
------------ | ||
- Chef 12.6+ | ||
- Network accessible web server hosting the MQ installer package | ||
|
||
Platform Support | ||
---------------- | ||
The following platforms have been tested with Test Kitchen: | ||
|
||
- Ubuntu 14.04 | ||
|
||
Cookbook Dependencies | ||
--------------------- | ||
- [limits](https://supermarket.chef.io/cookbooks/limits) | ||
- [yum](https://supermarket.chef.io/cookbooks/yum) | ||
|
||
Usage | ||
----- | ||
1. Add ```depends 'ibm_mq'``` to your cookbook's metadata.rb | ||
2. Use the resources shipped in cookbook in a recipe, the same way you'd | ||
use core Chef resources (file, template, directory, package, etc). | ||
|
||
```ruby | ||
ibm_mq_installation 'Installation1' do | ||
source 'http://10.0.2.15:8000/WS_MQ_V8.0.0.4_LINUX_ON_X86_64_IM.tar.gz' | ||
accept_license true | ||
end | ||
|
||
ibm_mq_queue_manager 'qm1' do | ||
action [:create, :start] | ||
end | ||
``` | ||
|
||
Resources | ||
--------- | ||
|
||
## ibm_mq_installation | ||
The `ibm_mq_installation` resource downloads an IBM MQ download package file, | ||
specified by a URI. | ||
|
||
#### Example | ||
```ruby | ||
ibm_mq_installation 'Installation1' do | ||
source 'http://10.0.2.15:8000/WS_MQ_V8.0.0.4_LINUX_ON_X86_64_IM.tar.gz' | ||
accept_license true | ||
action :create | ||
end | ||
``` | ||
|
||
#### Properties | ||
- `source` - Path to network accessible IBM MQ installation package. | ||
- `accept_license` - Set this to `true` if you accept the terms of the IBM MQ license. | ||
- `packages` - An array of package names to install. Defaults to: | ||
`%w(MQSeriesServer MQSeriesGSKit)` | ||
- `uid` - The UID to use for the `mqm` user | ||
- `gid` - The GID to use for the `mqm` user | ||
|
||
## ibm_mq_queue_manager | ||
The `ibm_mq_queue_manager` resource creates and starts IBM MQ queue managers. | ||
|
||
#### Example | ||
```ruby | ||
ibm_mq_queue_manager 'qm1' do | ||
action [:create, :start] | ||
end | ||
``` | ||
|
||
#### Properties | ||
- `user` - User to run MQ commands as. Defaults to `mqm` | ||
|
||
|
||
## Maintainers | ||
|
||
* Arthur Barr (<[email protected]>) | ||
|
||
## Developing | ||
If you do submit a Pull Request related to this cookbook, please indicate in the Pull Request that you accept and agree to be bound by the terms of the [IBM Contributor License Agreement](CLA.md). | ||
|
||
In order to run the Test-Kitchen tests, you need to set an environment variable for the MQ download. For example, on Linux, you might do the following: | ||
|
||
```shell | ||
export MQ_URI=http://10.0.2.15:8000/WS_MQ_V8.0.0.4_LINUX_ON_X86_64_IM.tar.gz | ||
``` | ||
|
||
## License | ||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.vagrant | ||
Berksfile | ||
Berksfile.lock | ||
.kitchen* | ||
spec/* | ||
test/* | ||
.git | ||
.gitignore | ||
Thumbs.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
name 'ibm_mq' | ||
maintainer 'IBM' | ||
maintainer_email '[email protected]' | ||
license 'Apache 2.0' | ||
description 'Installs/Configures IBM MQ' | ||
long_description 'Installs/Configures IBM MQ' | ||
version '0.1.0' | ||
depends 'limits' | ||
depends 'yum' | ||
supports 'ubuntu' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
# (C) Copyright IBM Corporation 2016. | ||
# | ||
# 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. | ||
|
||
property :source, kind_of: String, required: true | ||
property :accept_license, kind_of: [TrueClass, FalseClass], default: false | ||
property :packages, kind_of: Array, default: %w(MQSeriesServer MQSeriesGSKit) | ||
property :default, kind_of: [TrueClass, FalseClass], default: false | ||
property :uid, kind_of: [String, Integer], default: nil | ||
property :gid, kind_of: [String, Integer], default: nil | ||
|
||
default_action :create | ||
|
||
# This action does the following: | ||
# * Downloads the MQ install package | ||
# * Extracts the install package | ||
# * Adds a Yum repository pointing at the MQ RPM files | ||
# * Accepts the license, as specified | ||
# * Installs the MQ packages, as specified | ||
# * Sets the default MQ installation, as specified | ||
action :create do | ||
fail 'You must accept the license to install IBM MQ.' unless accept_license | ||
fail 'Non-default installations are not currently supported' unless default | ||
|
||
# include_recipe 'sysctl::ohai_plugin' | ||
# | ||
# sysctl_param 'fs.file-max' do | ||
# value 524_289 | ||
# only_if node['sys']['fs']['file-max'] < value | ||
# end | ||
|
||
download_dir = "#{Chef::Config[:file_cache_path]}/ibm_mq" | ||
download_path = "#{download_dir}/#{name}.tar.gz" | ||
unpack_dir = "#{download_dir}/extract-#{name}" | ||
|
||
directory download_dir do | ||
owner 'root' | ||
group 'root' | ||
mode '0755' | ||
action :create | ||
end | ||
|
||
directory unpack_dir do | ||
owner 'root' | ||
group 'root' | ||
mode '0755' | ||
action :create | ||
end | ||
|
||
package %w(rpm yum createrepo) do | ||
action :install | ||
end | ||
|
||
remote_file download_path do | ||
source new_resource.source | ||
action :create | ||
notifies :run, 'execute[extract-mq-package]', :immediately | ||
notifies :run, 'execute[createrepo-mq]', :immediately | ||
backup false | ||
action :create | ||
end | ||
|
||
execute 'extract-mq-package' do | ||
command "tar -xvf #{download_path}" | ||
cwd unpack_dir | ||
# Only run after notified by remote_file download | ||
action :nothing | ||
end | ||
|
||
execute 'createrepo-mq' do | ||
user 'root' | ||
cwd "#{unpack_dir}/MQServer" | ||
command 'createrepo .' | ||
end | ||
|
||
group 'mqm' do | ||
gid new_resource.gid | ||
action :create | ||
end | ||
|
||
user 'mqm' do | ||
uid new_resource.uid | ||
group 'mqm' | ||
home '/var/mqm' | ||
action :create | ||
end | ||
|
||
set_limit 'mqm' do | ||
type 'soft' | ||
item 'nofile' | ||
value 10_240 | ||
end | ||
|
||
set_limit 'mqm' do | ||
type 'hard' | ||
item 'nofile' | ||
value 10_240 | ||
end | ||
|
||
execute 'Accept the mqlicense' do | ||
user 'root' | ||
cwd "#{unpack_dir}/MQServer" | ||
command './mqlicense.sh -accept -text_only' | ||
end | ||
|
||
# Work around bug in 'yum' cookbook | ||
# See https://github.com/chef-cookbooks/yum/issues/144 | ||
directory '/etc/yum.repos.d' do | ||
owner 'root' | ||
group 'root' | ||
mode '0755' | ||
action :create | ||
end | ||
|
||
# Add a local yum repository | ||
yum_repository "ibm-mq-chef-#{name}" do | ||
description 'Packages for IBM MQ, used by Chef cookbook' | ||
baseurl "file://#{unpack_dir}/MQServer" | ||
gpgcheck false | ||
action :create | ||
end | ||
|
||
# Install MQ | ||
yum_package packages do | ||
action :install | ||
end | ||
|
||
# TODO: Unset as default installation, if no longer default | ||
execute 'setmqinst' do | ||
command '/opt/mqm/bin/setmqinst -n Installation1 -i' | ||
only_if { default } | ||
end | ||
end | ||
|
||
action :remove do | ||
# Uninstall MQ | ||
yum_package packages do | ||
action :remove | ||
end | ||
|
||
# Remove our Yum repository | ||
yum_repository "ibm-mq-chef-#{name}" do | ||
action :remove | ||
end | ||
end |
Oops, something went wrong.