プランは、特定のホストで 1 つまたは複数のコンポーネントの管理に使用する一連の命令です。たとえば、プランで 3 つのコンポーネントをインストールして、別のコンポーネントの起動制御を開始することができます。ほとんどの場合、プランを作成するには、XML を編集する必要があります。この規則への唯一の例外は、自動生成プランです。Sun N1 Service Provisioning System ソフトウェアでは、直接実行手続きから構成されるプランを自動的に生成できます。たとえば、1 つのコンポーネントのインストールから構成されるプランを自動生成できます。次に、このプランを直接実行するか、保存してほかの複雑なプランを作成するテンプレートとして使用できます。
N1 SPS ソフトウェアでは、プランのバージョンを取得できます。プラグインのプランを変更し、これらのプランを N1 SPS 環境にチェックインすると、プランに新しいバージョン番号が割り当てられます。プラグインを使用してアプリケーションをプロビジョニングするときに、配備に適切なプランのバージョンを選択できます。
単純プランには、一連の配備命令 (ステップ) が含まれます。単純プランは、1 つのホストまたはホストセットで実行します。単純プランでは、インストールやアンインストールなどの共通の手続きを呼び出すことができます。また、条件付きのプログラミング構文も使用できます。
複合プランには、単純プランへの呼び出しが含まれます。複合プランでは、1 つのホストに手続きを適用すると同時に、ほかの手続きを別のホストまたはホストセットに適用できます。
単純プランの例を次に示します。このプランには、インストールブロックとアンインストールブロックがあります。プランの定義に使用する特定の要素や属性については、『Sun N1 Service Provisioning System 5.2 XML スキーマリファレンスガイド』の第 4 章「プランのスキーマ」を参照してください。
<?xml version="1.0" encoding="UTF-8"?>
<!-- generated by N1 SPS -->
<executionPlan xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
name='plugin-core.jar-1096573592002' version='5.12'
xsi:schemaLocation='http://www.sun.com/schema/SPSplan.xsd'
xmlns='http://www.sun.com/schema/SPS' path='/system/autogen'>
<simpleSteps>
<install blockName='default'>
<component name='plugin-core.jar' path='/system' version='1.1'>
</component>
</install>
<uninstall blockName='default'>
<installedComponent name='plugin-core.jar' versionOp='='
version='1.1' path='/system'>
</installedComponent>
</uninstall>
</simpleSteps>
</executionPlan>
複合プランの例を次に示します。この例では、3 つのサブプランを呼び出しています。
<executionPlan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="apache-tomcat-uninstall" version="5.2"
xsi:schemaLocation="http://www.sun.com/schema/SPSplan.xsd"
xmlns="http://www.sun.com/schema/SPS">
<compositeSteps>
<execSubplan planName="mod-jk-uninstall" />
<execSubplan planName="apache-uninstall" />
<execSubplan planName="tomcat-uninstall" />
</compositeSteps>
</executionPlan>
次の例に、条件に基づいて何を実行するかを決定する、より複雑なプランを示します。
<?xml version="1.0" encoding="UTF-8"?>
<!-- generated by CR -->
<executionPlan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="BAM_backout_new_version_NODE-A" version="5.2"
xsi:schemaLocation="http://www.sun.com/schema/SPSplan.xsd"
xmlns="http://www.sun.com/schema/SPS" path="/plans/uat">
<paramList>
<param name="backout_type" prompt="Enter type of backout (all,ear,prop)"></param>
</paramList>
<varList>
<var name="admin_server" default="wusx119"></var>
<var name="node" default="wust3022"></var>
<var name="wl_server_name" default="bamC"></var>
<var name="apphome" default="/opt/uat/ceodomain"></var>
<var name="prop_args" default="-s wust3022"></var>
<var name="application_name" default="bam"></var>
<var name="staging_base" default="/usr/local"></var>
<var name="user" default="weblogic"></var>
</varList>
<simpleSteps limitToHostSet="uat-bam">
<if>
<condition>
<or>
<equals value2="all" value1=":[backout_type]"></equals>
<equals value2="prop" value1=":[backout_type]"></equals>
<equals value2="ear" value1=":[backout_type]"></equals>
</or>
</condition>
<then>
<call blockName="backout_application">
<argList application_name=":[application_name]"
staging_base=":[staging_base]"
backout_type=":[backout_type]"
user=":[user]">
</argList>
<installedComponent name="deploy_tools"
path="/components/function_library">
</installedComponent>
</call>
<call blockName="wl_stop">
<argList wl_server_name=":[wl_server_name]"
node=":[node]" apphome=":[apphome]" user=":[user]">
</argList>
<installedComponent name="deploy_tools"
path="/components/function_library">
</installedComponent>
</call>
<if>
<condition>
<equals value2="all" value1=":[backout_type]"></equals>
</condition>
<then>
<call blockName="clusterdeploy">
<argList application_name=":[application_name]"
staging_base=":[staging_base]" node=":[node]" user=":[user]">
</argList>
<installedComponent name="deploy_tools"
path="/components/function_library">
</installedComponent>
</call>
<call blockName="deploy_prop">
<argList application_name=":[application_name]"
prop_args=":[prop_args]" staging_base=":[staging_base]"
user=":[user]">
</argList>
<installedComponent name="deploy_tools"
path="/components/function_library">
</installedComponent>
</call>
<call blockName="wl_startjsp">
<argList application_name=":[application_name]"
wl_server_name=":[wl_server_name]"
node=":[node]" apphome=":[apphome]" user=":[user]">
</argList>
<installedComponent name="deploy_tools"
path="/components/function_library">
</installedComponent>
</call>
</then>
</if>
<if>
<condition>
<equals value2="ear" value1=":[backout_type]"></equals>
</condition>
<then>
<call blockName="clusterdeploy">
<argList application_name=":[application_name]"
staging_base=":[staging_base]" node=":[node]" user=":[user]">
</argList>
<installedComponent name="deploy_tools"
path="/components/function_library">
</installedComponent>
</call>
<call blockName="wl_startjsp">
<argList application_name=":[application_name]"
wl_server_name=":[wl_server_name]"
node=":[node]" apphome=":[apphome]" user=":[user]">
</argList>
<installedComponent name="deploy_tools"
path="/components/function_library">
</installedComponent>
</call>
</then>
</if>
<if>
<condition>
<equals value2="prop" value1=":[backout_type]"></equals>
</condition>
<then>
<call blockName="deploy_prop">
<argList application_name=":[application_name]"
prop_args=":[prop_args]"
staging_base=":[staging_base]" user=":[user]">
</argList>
<installedComponent name="deploy_tools"
path="/components/function_library">
</installedComponent>
</call>
<call blockName="wl_start">
<argList application_name=":[application_name]"
wl_server_name=":[wl_server_name]"
node=":[node]"
apphome=":[apphome]"
user=":[user]">
</argList>
<installedComponent name="deploy_tools"
path="/components/function_library">
</installedComponent>
</call>
</then>
</if>
</then>
<else>
<raise message="Please enter a valid deployment type (all/ear/prop)"></raise>
</else>
</if>
</simpleSteps>
</executionPlan>
「Components」ページを表示します。
プランを生成するコンポーネントを選択します。
コンポーネントの詳細を表示します。
「Component Procedures」が表示されていない場合は、表示されるまでページをスクロールダウンします。
プランで使用する手続きを選択します。
「Generate Plan with Checked Procedures」をクリックします。
「Plans」編集ページが表示されます。このページから、XML を変更して例 2–5 に示すような複雑なステップを含めることができます。