aririikonen / oracle

Full Oracle cookbook for Chef. Please see the README.md for further details.
http://oraarir.blogspot.fi/
44 stars 50 forks source link

Description

Installs and configures the Oracle RDBMS, patches it to the latest version and creates databases.

New features on v1.2.0

(Oracle client install is still 11g R2)

Tested with an Open Source Chef Server/Chef Client combo only.

Oracle version 11.2.0.3 was used to develop this cookbook, but the code should work for other versions as well, with some modifications.

At the time this cookbook was being developed the latest patch was Patch 14727310 - 11.2.0.3.5, but it has now been updated to the latest patch from Oracle 7/16/2013, Patch 16619892 - 11.2.0.3.7 Patch Set Update.

For guidelines on how to adapt the cookbook for other PSU versions, see latest_dbpatch, under Recipes, below.

Quickstart (database)

Quickstart (client)

Requirements

Oracle

See here:

Oracle's requirements for 11g

Oracle's requirements for 12c

Chef

This cookbook was successfully tested using Chef-Client 11, in combo with the open source Chef Server 11, as well as with Hosted Chef.

Version 1.2.0 has been tested against Chef-Client (11.10.4) and open source Chef Server 11 (11.0.10).

If you use the open source Chef Server, because installing a database takes a long while, and owing to CHEF-3045, you'll want to increase the value of erchef['s3_url_ttl'] in /etc/chef-server/chef-server.rb; which value to choose depends on the number of databases you create, and how fast your nodes are. In most cases, this should give you room to spare to install a couple databases:

erchef['s3_url_ttl'] = 9999

then run chef-server-ctl reconfigure to reconfigure Chef Server.

Platforms

oracle was tested on the distros/versions given above; YMMV on older versions of their 6.x branches. The development target was Centos x86_64 minimal install. DISCLAIMER: note that, out of these platforms, Oracle Database 11g R2 and 12c R1 are only certified on RHEL 6 :-) For more detail, check the certification matrix on My Oracle Support: certification matrix

Packages

Miscellaneous

Attributes

oracle defines a single top-level namespace: :oracle. Values that pertain to the whole Oracle setup (not only the RDBMS) are defined there directly:

:oracle has four children:

Attributes under :user are specific to the oracle user, as you may have guessed:

Attributes under :cliuser are specific to the oracli user, as you may have guessed:

Attributes under :rdbms relate to the Oracle RDBMS proper, rather unsurprisingly:

Attributes under :client relate to the Oracle Client proper, rather unsurprisingly:

Recipes

By order of appearance in a typical workflow:

default

Includes 5 recipes, which are, in order:

IOW, we set up the oracle user, install Oracle's dependencies, tweak the kernel's parameters, then install the Oracle binaries (unless we've done so already, and patch them to the latest patch version (unless we've done so already).

oracli

Includes 5 recipes, which are, in order:

IOW, we set up the oracli user, install Oracle's dependencies, tweak the kernel's parameters, then install the Oracle Client binaries (unless we've done so already, and patch them to the latest patch version (unless we've done so already).

oracle_user_config

Create and configure the oracle user. Its password is only set if node[:oracle][:user][:pw_set]'s value isn't true . node[:oracle][:user][:pw_set]'s value is false by default; it's flipped to true after we set the password, meaning that, if you want to change the password after the first Chef run, you'll have to flip it back.

The recipe expects the oracle user password to be stored in an encrypted data bag item; the bag's name is controlled by the node[:oracle][:user][:edb] attribute, whose default value is oracle. The item's name is controlled by the node[:oracle][:user][:edb_item] attribute, whose default value is foo.

The recipe requires the encrypted item to include a key named pw, whose value you must set to the oracle user's password.

For more detail on encrypted data bags, see: Opscode's doc on encrypted data bags

oracli_user_config

Create and configure the oracli user. Its password is only set if node[:oracle][:cliuser][:pw_set]'s value isn't true . node[:oracle][:cliuser][:pw_set]'s value is false by default; it's flipped to true after we set the password, meaning that, if you want to change the password after the first Chef run, you'll have to flip it back.

The recipe expects the oracli user password to be stored in an encrypted data bag item; the bag's name is controlled by the node[:oracle][:cliuser][:edb] attribute, whose default value is oracli. The item's name is controlled by the node[:oracle][:cliuser][:edb_item] attribute, whose default value is foo.

The recipe requires the encrypted item to include a key named pw, whose value you must set to the oracli user's password.

For more detail on encrypted data bags, see: Opscode's doc on encrypted data bags

deps_install

Installs the Oracle RDBMS' dependencies, which are specified as an Array of package names that's the value of node[:oracle][:rdbms][:deps].

deps_cli_install

Installs the Oracle Client' dependencies, which are specified as an Array of package names that's the value of node[:oracle][:client][:deps].

kernel_params

Configures kernel parameters for Oracle. We deploy a config file to /etc/sysctl.d/ora_params and reload sysctl settings.

ora_os_setup

Includes 3 recipes, which are, in order:

The recipe will set up the oracle user, install Oracle's dependencies and tweak the kernel's parameters.

dbbin

Installs Oracle RDBMS binaries. The install files are specified as an Array of URLs that's the value of the node[:oracle][:rdbms][:install_files] attribute.

Note: If you use the ora_quickstart or ora_12c_quickstart roles, they will override the values.

clibin

Installs Oracle Client binaries. The install files are specified as an Array of URLs that's the value of the node[:oracle][:client][:install_files] attribute.

Note: If you use the ora_cli_quickstart role, it will override the values.

latest_dbpatch

Installs latest patch for Oracle RDBMS. The patch file is specified as a URL that's the value of node[:oracle][:rdbms][:latest_patch][:url].

Also remember to update OPatch 6880880 to the latest version.

Previous or new PSU patches should work without many changes. 11.2.0.3.4, 11.2.0.3.7 and 11.2.0.3.8 worked fine in our environment.

cli_latest_patch

Installs latest patch for Oracle Client. The patch file is specified as a URL that's the value of node[:oracle][:client][:latest_patch][:url].

Also remember to update OPatch 6880880 to the latest version.

Previous or new PSU patches should work without many changes. 11.2.0.3.4, 11.2.0.3.7, 11.2.0.3.8 and 11.2.0.3.10 worked fine in our environment.

get_version

Included by latest_dbpatch. Populates node[:oracle][:rdbms][:install_info]'s Hash with key/value pairs that track the patch number, the patch's timestamp, and the version string, as extracted from the output of:

opatch lsinventory -bugs_fixed

get_cli_version

Included by cli_latest_patch. Populates node[:oracle][:client][:install_info]'s Hash with key/value pairs that track the patch number, the patch's timestamp, and the version string, as extracted from the output of:

opatch lsinventory -bugs_fixed

createdb

Creates databases. Iterates over the keys of the node[:oracle][:rdbms][:dbs]'s Hash, creating a database for each key whose value isn't truthy. You're meant to specify this Hash yourself, for example in a role, or as part of the bootstrap command line, e.g.:

[snip] -j '{"oracle" : {"rdbms": {"dbs": {"FOO" : false}}}}'

The value associated with a key is set to true after its corresponding database has been created.

logrotate_alert_log

logrotate config for the Oracle alert log.

logrotate_listener

logrotate config for the Oracle listener's log.

Usage Notes

Roadmap

For v1.3.0

For v1.4.0

For v2.0.0

For v3.0.0

Additional Info

Ari has a blog where he gets into more detail about our testing of oracle cookbook on two cloud providers (using Hosted Chef), and Chefy and Oracly things generally:

http://oraarir.blogspot.fi/

Contributing

  1. Fork the repository on Github: oracle's GitHub repo
  2. Create a named feature branch (like add_component_x)
  3. Write your changes
  4. Write tests for your changes (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request using Github

License and Authors

Copyright:: 2014, Ari Riikonen

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.