This module configures DB2 server and runtime client installations and configures instances.
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
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 { '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'),
}
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,
}
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 { 'db2inst1':
fence_user => 'db2fenc1',
installation_root => '/opt/ibm/db2/V10.5',
require => Db2::Install['10.5'],
}
db2::instance { 'db2inst1':
installation_root => '/opt/ibm/db2/V11.1',
type => 'client',
require => Db2::Install['11.1'],
}
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
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.
include db2
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
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
Numerous native types and providers exist to manage aspects of DB2 instances, these are documented below
Configures a DB2 instance. The instance user must already exist (the db2::instance
defined type does this for you).
db2_instance { 'db2inst1':
install_root => '/opt/ibm/db2/V11.1',
type => client,
fence_user => 'db2fence1',
auth => 'server',
}
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.
The db2_catalog_node
resource type manages the catalog entries for nodes on DB2 instances
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
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
The db2_catalog_database
resource type manages catalog entries for databases on DB2 instances.
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
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
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',
}
The db2_catalog_dcs
resource type manages catalog entries for database connection services (DCS) within a DB2 instance.
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
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
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.
- Written and maintained by Craig Dunn craig@craigdunn.org @crayfishx
- Sponsered by Baloise Group http://baloise.github.io