Version information
This version is compatible with:
- , ,
Start using this module
Add this module to your Puppetfile:
mod 'crayfishx-db2', '1.3.1'
Learn more about managing modules with a PuppetfileDocumentation
Puppet DB2 module
Contents
Introduction
This module configures DB2 server and runtime client installations and configures instances.
Pre-requisistes
The DB2 software package ships as an tarball and should be placed either in a Puppet file location, HTTP server or other source location compatible with the archive
type from puppet/archive
. For testing, the 90 day trial of DB2 server can be downloaded from The IBM DB2 download center
Numerous packages and other settings are required in order to support DB2 server, it is recommended that you run the pre-check script from DB2 on the system that you intend to deploy this module to and update your roles/profiles with the relevant pre-reqs for your system. The script can be found in the source tarball and can be run as
# ./db2prereqcheck -l
Some warnings can be ignored, please see the IBM documentation for more information
Usage
This module includes two defined resource types, db2::install
and db2::instance
. db2::install
is a defined resource type, and not a class, because it's possible to install multiple versions of DB2 server side by side on the same server, so this module allows for that. Note that the db2
baseclass must be included before declaring db2::instance
types in your manifests in order for certain variables and dependencies to be set.
This module has only been tested for DB2 10.5, but should work for earlier versions
db2::install
Usage example for DB2 Server
db2::install { '10.5':
source => 'http://content.enviatics.com/v10.5_linuxx64_server.tar.gz',
components => [
'ACS',
'APPLICATION_DEVELOPMENT_TOOLS',
'DB2_SAMPLE_DATABASE ',
'BASE_CLIENT',
'BASE_DB2_ENGINE',
'JAVA_SUPPORT',
'SQL_PROCEDURES',
'COMMUNICATION_SUPPORT_TCPIP'
],
license_content => template('db2/license/trial.lic'),
}
Usage example for DB2 Runtime client
db2::install { '11.1':
source => 'http://content.enviatics.com/ibm_data_server_runtime_client_linuxx64_v11.1.tar.gz',
product => 'RUNTIME_CLIENT',
components => [
'JAVA_SUPPORT',
'BASE_CLIENT'
],
configure_license => false,
}
Parameters
version
: set the version of DB2 to be installed (defaults to the resource title)extract
: Whether or not to download and extract the source file (default: true)source
: Source location of the tar.gz file, supports http,ftp,puppet and file URI's (see archive)filename
: Filename of the destination tarball, defaults to filename derived fromsource
installer_root
: The root directory of where the tarballs and extracted archives are stored. (default: /var/puppet_db2)installer_folder
: The sub-folder relative toinstaller_root
where the installer executables are stored.install_dest
: The target installation folder (default: /opt/ibm/db2/V)product
: The DB2 product ID (default: DB2_SERVER_EDITION)components
: An array of components to installlanguages
: An array of languages to install (default: [ 'EN' ])configure_license
: Whether or not to configure the licenselicense_content
: The license content as a string (cannot use with license_source)license_source
: The source of the license as a file source parameter (cannot use with license_content)
db2::instance
Usage example for a DB2 server instance
db2::instance { 'db2inst1':
fence_user => 'db2fenc1',
installation_root => '/opt/ibm/db2/V10.5',
require => Db2::Install['10.5'],
}
Usage example for a DB2 Runtime Client instance
db2::instance { 'db2inst1':
installation_root => '/opt/ibm/db2/V11.1',
type => 'client',
require => Db2::Install['11.1'],
}
Parameters
instance_user
: The username for the instance (defaults to resource title)fence_user
: The username of the fence user (optional, must be specified for a non-client instance)installation_root
: The root of the DB2 installation for this instancemanage_fence_user
: Whether or not to manage the fence user resource (default: true)fence_user_uid
: UID of the fence userfence_user_gid
: GID of the fence userfence_user_home
: Home directory of the fence usermanage_instance_user
: Whether or not to manage the instance user resource (default: true)instance_user_uid
: UID of the instance userinstance_user_gid
: GID of the instance userinstance_user_home
: Home directory of the instance usertype
: Type of product this instance is for (default: ese)auth
: Type of auth for this instance (default: server)users_forcelocal
: Force the creation of instance and fence users to be local, true or false. (default: undef)port
: Optionally specify a port name for the instance (default: undef)catalog_databases
: A hash of db2_catalog_database resources to pass to create_resourcescatalog_nodes
: A hash of db2_catalog_node resources to pass to create_resourcescatalog_dcs
: A hash of db2_catalog_dcs resources to pass to create_resources
db2
The db2 base class takes installations
and instances
as parameters and farms these to create_reosurces
to dynamically create DB2 installs and instances from Hiera data.
Usage sample
include db2
Hiera example for DB2 Server Installations
db2::installations:
'10.5':
source: 'http://content.enviatics.com/v10.5_linuxx64_server.tar.gz'
components:
- ACS
- APPLICATION_DEVELOPMENT_TOOLS
- DB2_SAMPLE_DATABASE
- BASE_CLIENT
- BASE_DB2_ENGINE
- JAVA_SUPPORT
- SQL_PROCEDURES
- COMMUNICATION_SUPPORT_TCPIP
license_content: |
[LicenseCertificate]
CheckSum=8085A37377DB3B127EA410B11BB041AF
TimeStamp=1356705072
PasswordVersion=5
VendorName=IBM Toronto Lab
...etc
db2::instances
db2inst1:
fence_user: db2fenc1
installation_root: /opt/ibm/db2/V10.5
Hiera example for DB2 Runtime Client installations
db2::installations:
'11.1':
source: http://content.enviatics.com/ibm_data_server_runtime_client_linuxx64_v11.1.tar.gz
product: RUNTIME_CLIENT
components:
- BASE_CLIENT
- JAVA_SUPPORT
configure_license: false
db2::instances:
db2inst1:
type: client
instance_user_uid: 10111
installation_root: /opt/ibm/db2/V11.1
Types and Providers
Numerous native types and providers exist to manage aspects of DB2 instances, these are documented below
db2_instance
Configures a DB2 instance. The instance user must already exist (the db2::instance
defined type does this for you).
Example usage
db2_instance { 'db2inst1':
install_root => '/opt/ibm/db2/V11.1',
type => client,
fence_user => 'db2fence1',
auth => 'server',
}
Parameters
install_root
: Path to the root of the DB2 installation (required)auth
: Authentication type (eg: server) (required)type
: Type of instance (eg: ese, client) (required)fence_user
: The name of the fence user (must already exist with a valid homedir)port
: The port name of the instance
The instance user and fence user will be autorequired by this type, but they must exist already or be in the catalog if calling this type directly.
db2_catalog_node
The db2_catalog_node
resource type manages the catalog entries for nodes on DB2 instances
Example usage
db2_catalog_node { 'db2node1':
instance => 'db2inst1',
install_root => '/opt/ibm/db2/V11.1',
type => 'tcpip',
remote => 'db2server.example.com',
server => 'db2srv',
security => 'ssl',
}
Would run the following
db2 CATALOG TCPIP NODE db2node1 REMOTE db2server.example.com SERVER db2srv SECURITY SSL
Parameters
install_root
: Path to the root of the DB2 installation (required)instance
: The name of the instance to configure (required)type
: The type of node, currently supported aretcpip
andlocal
to_instance
: Name of the instance referred to in the catalog command, not the instance that we are configuringadmin
: When set to true specifies an administration server (tcpip only)remote
: The hostname or IP address where the database resides (tcpip only)server
: The service name or port number of the database manager instance (tcpip only)remote_instance
: Specifies the name of the server instance where the database resides (tcpip only)security
: Specifies the node will be security enabled, valid values aresocks
andssl
(tcpip only)system
: Specifies the DB2 system name that is used to identify the server machineostype
: Specifies the OS type of the server machine (AIX, WIN, HPUX, SUN, OS390, OS400, VM, VSE, SNI, SCO, LINUX and DYNIX.)comment
: A description of the catalog entry
The db2_catalog_node
resource type will automatically require the corresponding db2_instance
resource if it is in the catalog
db2_catalog_database
The db2_catalog_database
resource type manages catalog entries for databases on DB2 instances.
Usage example
db2_catalog_database { 'DB2DBXX':
instance => 'db2inst1',
install_root => '/opt/ibm/db2/V11.1',
node => 'MYNODE2',
authentication => 'dcs',
}
Would run the following
db2 CATALOG DATABASE DB2DBXX AT NODE MYNODE2 AUTHENTICATION dcs
Parameters
install_root
: Path to the root of the DB2 installation (required)instance
: The name of the instance to configure (required)as_alias
: The alias of the database entry. This attribute is also the namevar, so if ommited, the resource title will be used as the alias name, this is the unique identifier for the resourcedb_name
: The database name to catalog, if this option is ommited then theas_alias
(or the resource title) will be used as the database namepath
: Specify the path where the database resides (cannot use withnode
)node
: Specify the name of the database partition server where the database resides (cannot use withpath
)authentication
: Specify an authentication type (SERVER, CLIENT, SERVER_ENCRYPT..etc)comment
: A description of the catalog entry
Title patterns
The as_alias
attribute is the resource type's namevar, a short hand notation also exists to map both the as_alias
and db_name
attributes from the title of the resource using a comma delimited string as the title. Therefore, this example;
db2_catalog_database { 'DB2 Database X':
instance => 'db2inst1',
install_root => '/opt/ibm/db2/V11.1',
as_alias => 'DB2X',
db_name => 'DB2DBFOO',
node => 'MYNODE2',
authentication => 'dcs',
}
... can be written as...
db2_catalog_database { 'DB2X:DB2DBFOO'
instance => 'db2inst1',
install_root => '/opt/ibm/db2/V11.1',
node => 'MYNODE2',
authentication => 'dcs',
}
db2_catalog_dcs
The db2_catalog_dcs
resource type manages catalog entries for database connection services (DCS) within a DB2 instance.
Usage example
db2_catalog_dcs { 'DB2DB1':
instance => 'db2inst1',
install_root => '/opt/ibm/db2/V11.1',
target => 'dsn_db_1',
}
Would run
db2 CATALOG DCS DATABASE DB2DB1 AS dsn_db_1
Parameters
install_root
: Path to the root of the DB2 installation (required)instance
: The name of the instance to configure (required)target
: The name of the target system to catalogar_library
: The name of the AR library to load. Do not specify if using DB2 Connectparams
: Parameters to pass to the application requestor (AR) librarycomment
: A description of the catalog entry
Testing
Vagrant
In order to use the boot the vagrant box and set up a DB2 instance to test with, you should first obtain the 90 day trial from IBM's website and place the v10.5_linuxx64_server_t.tar.gz
in the root directory of this repo. Then run vagrant up
. The provisioner will set up some pre-reqs and run the code from tests/vagrant.pp
. It should install DB2, configure an instance, add a sample database using the SAMPLE_DATABASE
component and connect to it.
Author
- Written and maintained by Craig Dunn craig@craigdunn.org @crayfishx
- Sponsered by Baloise Group http://baloise.github.io
Types in this module release
1.3.1
- #21 introduced a feature to remove the large archive files after installation, but Puppet continues to archive these by default in the client_bucket - this fix adds
backup => false
to those file resources to prevent this from happening. https://github.com/crayfishx/puppet-db2/pull/23
1.3.0
Internal feature
- Better handling of archive clean up to stop the module leaving large installer files on the system: https://github.com/crayfishx/puppet-db2/pull/21
1.2.1
- Bumped dependency version for puppet/archive to < 2.0.0
1.2.0
Feature
- Attributes for
db2_catalog_node
,db2_catalog_database
anddb2_catalog_dcs
are now puppet properties, rather than parameters, which means Puppet will now enforce changes after creation and maintain the state of the catalog entries... eg:
Notice: /Stage[main]/Db2/Db2::Instance[db2test4]/Db2_catalog_node[DB2NODE1]/remote: remote changed 'db12.example.com' to 'db15.example.com'
This addresses the idempotency limitations of the resource types. Previously Puppet would use the attributes to create the catalog entry but if they were later changed in Puppet, it would not enforce the changes.
Bugfixes
- Bugfix: quotes for
comment
attribute andparams
attributes - Bugfix: renamed
PARAMS
toPARMS
for the catalog_dcs provider
Other
- Fixed some validation issues with types
- Added more spec tests
1.1.1
Bugfix release. This release addresses issues around the types and providers for managing DB2 catalog entries.
Fix errors when configuring a new instance
When a newly created instance is configured, puppet fails when
determining whether or not nodes, dcs and database entries exist because
the command "db2 LIST * DIRECTORY
" will cause db2 to throw an error
because the directory doesn't exist. There are various scenarios here
so the best way is to allow db2_exec
to fail when being called from the
exists? method. Therefore all exists? methods now call db2_exec_nofail
Fix idempotency problems with admin node entries
Previously, any nodes added as admin => true
would cause puppet to try
and configure them again on the next run, thats because we need to
separate commands to list the configured nodes, list node directory and
list admin node directory. This change adds support to the
db2_catalog_node
provider to query both types of node entry and return a
unified result. https://github.com/crayfishx/puppet-db2/pull/10
server parameter for db2_catalog_node
now optional
https://github.com/crayfishx/puppet-db2/pull/11
1.1.0
Feature release. This release adds several types and providers for configuring DB2 catalog entries in an instance. Also added is a db2_instance
type for managing DB2 instances themselves, replacing the exec resource that previously existed in the db2::instance
defined type.
New types and providers added:
db2_instance
db2_catalog_node
db2_catalog_database
db2_catalog_dcs
See the docs for usage instructions.
Reference: https://github.com/crayfishx/puppet-db2/pull/9
1.0.1
- Forge code quality (lint) release
1.0.0
- Issue #4 : Added 'port' parameter to
db2::instance
- DB2 runtime installations and instances now supported (see docs)
0.3.1
- Issue #1 : Add ability to specify forcelocal for user creation
0.3.0
- BREAK: More sensible default for install_folder in db2::install, now uses universal instead of server_t
0.2.0
- Added
license_source
parameter, licenses can now either be added as strings withlicense_content
or a file location given withlicense_source
0.1.2
- No functional changes, forge quality control release.
Dependencies
- puppetlabs-stdlib (>= 4.11.0 < 5.0.0)
- puppet-archive (>= 0.5.0 < 2.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 2016 Craig Dunn <craig@craigdunn.org> 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.