LoginSignup
3
3

More than 5 years have passed since last update.

Chefを使ってOracle製品のサイレント・インストールの準備してみた

Last updated at Posted at 2016-06-07

概要

Oracle製品をインストールする時にインストール・ウィザードを立ち上げて構成を決めながらインストールするのもよいですが、次のような場合は冗長な作業に思う事がないでしょうか

  • 構成を予め決めている環境を作成する場合
  • 同一の環境を複数作成する場合
  • GUIがない状況で環境を作成する場合

そのような時には、サイレント・インストールが利用できます。
そのサイレント・インストールを実行するには、Inventory Pointer Location File (oraInst.loc)を事前に作成しておく必要があります。
このInventory Pointer Location Fileの作成をChefを利用して行ってみます。

Inventory Pointer Location File

Oracle製品のインストーラは、インベントリ・ディレクトリを利用して、システムにインストールしているOracle製品をトラッキングを行います。
このインベントリ・ディレクトリの情報を格納しているファイルがInventory Pointer Location File (oraInst.loc)です。

oraInst.locファイルの内容

oraInst.locファイルに含まれる情報は非常にシンプルで次の2行だけです。

oraInst.loc
inventory_loc=インベントリ・ディレクトリのフルパス
inst_group=書き込み権限を持つグループ名

Chefを使ってやりたい事

Chefを使ってoraInst.locファイルに設定するインベントリ・ディレクトリやグループ名をパラメータ化して生成できるようにします。

今回作成するRecipe

  • oraInst.locファイルの作成
    • インベントリ・ディレクトリ及びインストール・グループ名のパラメータ化

Recipe. oraInst.locファイルの作成

以下の3種類のoraInst.locファイルで作成します。
- Recipe
- Template
- Attribute

TemplateでoraInstの骨子を作り、Attributeでデフォルトパラメータを定義し、Recipeでパラメータを利用してoraInst.locファイルを生成・配置します。

  • Template
templates/default/oraInst.loc.erb
inventory_loc=<%= @inventory_location %>
inst_group=<%= @inventory_group %>

inventory_locationシンボルとinventory_groupシンボルで定義されているハッシュ値をそれぞれ取得して設定しています。

  • Attribute
attributes/default.rb
default['inventory']['group'] = 'oinstall'
default['inventory']['owner'] = 'oracle'
default['inventory']['oraInst'] = '/root/oraInst.loc'
default['inventory']['location'] = '/u01/app/oraInventory'

パラメータのデフォルト値を設定しています。

  • Recipe
recipes/deploy.rb
directory node['inventory']['location'] do
  owner node['inventory']['owner']
  group node['inventory']['group']
  recursive true
  mode 0775
end
template node['inventory']['oraInst'] do
  source 'oraInst.loc.erb'
  owner node['inventory']['owner']
  group node['inventory']['group']
  mode '0644'
  variables(
    inventory_location: node['inventory']['location'],
    inventory_group: node['inventory']['group']
  )
end

templateリソースを利用してoraInst.loc.erbを配置し、オーナー及びパーミッション設定を行います。

まとめ

サイレント・インストールを行う際には必須になるので、Oracle製品環境を作るときには実行しておくとよいかもしれないですね。
実際に各製品のサイレント・インストールを行うには、oraInst.locに加えて各製品のレスポンス・ファイルが必要になります。

-今回のレシピ:https://github.com/shinyay/chef-oracle-inventory/blob/publish_20160607

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3