olemyk.ansible_role_db2

DB2 Installation Guide

This guide is for installing IBM DB2 using a simple role.

Requirements

You need a compressed copy of DB2. You can either download it from a remote URL or use a local copy that’s on your Ansible host.

ROOT ACCESS REQUIRED This role only works with root access. While you can install DB2 without root, features like creating instances require root access. Make sure to run the installation as the root user or use privilege escalation with sudo.

Role Variables

DB2_BINARY

This section controls how to send the DB2 binary to remote hosts.

  • db2_binary.url: URL to download the DB2 package (don’t set this if using a local copy).
  • db2_binary.location: Path to save the file if URL wasn’t used.
  • db2_binary.dest: Where to decompress DB2 on the remote host.
db2_binary:
    url: https://mycompany.com/downloads/db2_11_5.tar.gz
    location: /ansible/files/db2_11.5.tar.gz
    dest: /tmp

For more info on downloading DB2 from a URL, see the example here. To use a local copy, check this example.

DB2_BINARY_LICENSE

For the DB2 License package:

  • db2_license_binary.url: URL to download the DB2 license (don’t set this if using a local copy).
  • db2_license_binary.location: Path to save the file if URL wasn’t used.
  • db2_license_binary.dest: Where to decompress the DB2 license on the remote host.
db2_license_binary:
  url: "https://mycompany.com/downloads/DB2_AWSE_Restricted_Activation_11.5.zip"
  location: "/download/installer/db2_license.tar.gz"
  dest: "/download/installer"

DB2_CREATES

The DB2 tar.gz usually creates a folder named server, but some may create different folders (like expc for DB2 Express C). Change this variable if needed.

db2_creates: 'expc'

DB2_LICENSE_CREATES

Similar to the above, but for license files. Change this if your tar.gz creates a different folder.

db2_license_creates: 'awse_o'

DB2_PACKAGES

List of packages the role should install before running the DB2 installer. Keep as default unless you’re sure about changes.

For more details on required packages for DB2 on Linux, see here.

RESP

This section is used for customizing the DB2 installation.

  • prod: Which DB2 product will be installed
  • file: Directory for DB2 installation
  • lic_agreement: Accept or decline the license (declining means DB2 won’t be installed)
  • install_type: Type of installation (TYPICAL, COMPACT, CUSTOM)
resp:
   prod: "DB2_SERVER_EDITION"
   file: "/opt/ibm/db2/V11.1"
   lic_agreement: "ACCEPT" # ACCEPT or DECLINE
   install_type: "TYPICAL" # TYPICAL, COMPACT, CUSTOM

For DB2 Express-C:

 resp:
   prod: "EXPRESS_C"
   file: "/opt/ibm/db2/V11.1"
   lic_agreement: "ACCEPT" # ACCEPT or DECLINE
   install_type: "TYPICAL" # TYPICAL, COMPACT, CUSTOM

NOTE: By using this role, you accept the IBM license.

Dependencies

None

Example Playbook

All custom options are in an example file in the examples folder.

You must specify where to get DB2:

- hosts: servers
  roles:
     - db2
  vars:
    db2_binary:
      location: /ansible/files/db2_11.1.tar.gz
      dest: /tmp

Installing DB2 Without Instances

If you only want to install DB2 without creating instances (like in a cluster failover scenario), use the following variable:

vars:
  create_instances: false

See the full example here.

Creating a Custom Instance

By default, an instance will be created with DB2 default settings, but you can customize it using the db2_instances hash.

Full example can be found here:

db2_instances:
  - instance: "DB2INST"
    name: "myinstan" 
    group_name: "myinadm"
    fenced_username: "myfenc1"
    fenced_group_name: "myfadm1"

You can create multiple instances. An example with two instances is available here.

Customizing Parameters

You can customize both global and instance parameters using the dbm_params hash.

db2_instances:
 - instance: "DB2INST"
   name: "myinstan" 
   group_name: "myinadm"
   fenced_username: "myfenc1"
   fenced_group_name: "myfadm1"
   dbm_params:
     intra_parallel: "YES"
     numdb: "20"

See the complete example here.

Global Parameters

Define global parameters with the global_params hash:

global_params:
    db2_antijoin: "YES"
    db2fcmcomm: "TCPIP4"

See the full example here.

Creating Databases

By default, this role doesn’t create databases. If you want to add them, define a list in the databases hash.

Complete example is available here:

databases:
 - name: mydb
   instance: db2inst1
 - name: otherdb
   instance: db2inst2
   codeset: "UTF-8"
   territory: "en"
   pagesize: "16384"

Disclaimer

This role may not work for all setups. Use at your own risk.

Developing

If you'd like to help, please submit an issue or a pull request.

License

BSD

Author Information

Originally by Bernardo Vale

Informazioni sul progetto

Simple role to install IBM DB2 database

Installa
ansible-galaxy install olemyk.ansible_role_db2
Licenza
Unknown
Download
186
Proprietario