From 3e02ce0e4fa902919234bda2cec86f3dc194a63a Mon Sep 17 00:00:00 2001 From: jjhua Date: Mon, 8 Apr 2013 06:19:41 +0000 Subject: [PATCH] Added code for xCAT chef intergration on RH git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15853 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- .../kit_build/chef/chef-x86_64/buildkit.conf | 227 ++++++++++++++++++ .../chef/chef-x86_64/scripts/client.post | 28 +++ .../chef/chef-x86_64/scripts/server.post | 23 ++ .../chef/chef-x86_64/scripts/workstation.post | 28 +++ 4 files changed, 306 insertions(+) create mode 100644 xCAT-buildkit/share/xcat/kits/kit_build/chef/chef-x86_64/buildkit.conf create mode 100755 xCAT-buildkit/share/xcat/kits/kit_build/chef/chef-x86_64/scripts/client.post create mode 100755 xCAT-buildkit/share/xcat/kits/kit_build/chef/chef-x86_64/scripts/server.post create mode 100755 xCAT-buildkit/share/xcat/kits/kit_build/chef/chef-x86_64/scripts/workstation.post diff --git a/xCAT-buildkit/share/xcat/kits/kit_build/chef/chef-x86_64/buildkit.conf b/xCAT-buildkit/share/xcat/kits/kit_build/chef/chef-x86_64/buildkit.conf new file mode 100644 index 000000000..bea4a6aaa --- /dev/null +++ b/xCAT-buildkit/share/xcat/kits/kit_build/chef/chef-x86_64/buildkit.conf @@ -0,0 +1,227 @@ +# Kit Build File +# +# This file was initially auto-generated by the buildkit CLI command. +# To create a new kit, the user should modify this file accordingly. +# Refer to the buildkit manpage for further details. +# + +# kit: This section defines general info for the Kit. +# There must be exactly one kit section in a kit build file. +# +# kit attributes: +# basename (mandatory) Kit base name. e.g., kit-lsf +# description (optional) Kit description. +# version (mandatory) Kit version. e.g., 1.0 +# release (optional) Kit release. e.g., 1 +# ostype (mandatory) Kit OS type. Must be Linux. +# AIX is currently not supported. +# isinternal (optional) PCM use only. +# Indicate if Kit is for internal use. +# Use 1 for yes, 0 for no. Default: 0 +# kitdeployparams (optional) Filename containing a list of kit deployment +# parameters, relative to +# /other_files +# kitlicense (mandatory) Kit license string to be built into all +# kitcomponent packages +# kittarfilename (optional) Filename.tar.bz2 to be used for the generated +# kit. Default is --.tar.bz2 +kit: + basename=chef + description=Kit for installing puppet server and client + version=1.0 + release=1 + ostype=Linux + kitlicense=EPL + + +# kitrepo: This section defines a Kit Package Repository. +# There must be at least one kitrepo section in a kit build file. +# If you want to support multiple OSes, you should create a separate +# repo for each OS. Also, no two repos can be defined with the same +# OS name, major/minor version and arch. For example, you cannot have +# two repos for RHEL 6.2 x86_64 in the same kit. +# +# kitrepo attributes: +# kitrepoid (mandatory) Kit package repository ID. +# Must be unique within this file. +# osbasename (mandatory) OS distro base name. e.g., rhels. +# osmajorversion (mandatory) OS major version. e.g., 6 +# osminorversion (optional) OS minor version. +# osarch (mandatory) OS architecture. e.g., x86_64 +# compat_osbasenames (optional) Comma-separated list of compatible +# OS distro base names. e.g., centos + +kitrepo: + kitrepoid=rhels6_x86_64 + osbasename=rhels + osmajorversion=6 + #osminorversion= + osarch=x86_64 + + #compat_osbasenames= + + +# kitcomponent: This section defines one Kit Component. +# There can be zero or more kitcomponent sections. +# If you want to build a component which supports multiple OSes, +# you should create one kitcomponent section for each OS. +# Also, no two components in a kit can be defined with the same +# base name. +# You can define multiple kit components with the same base name +# only if each kit component using this base name meets these +# requirements: +# - Each kit component must be defined with the same version +# and release number +# - Each kit component must be defined with a unique kitrepoid + +# +# kitcomponent attributes: +# basename (mandatory) Kit component base name +# description (optional) Kit component description +# version (optional) Kit component version. If not set, defaults +# to kit version +# release (optional) Kit component release. If not set, defaults +# to kit release. Error if both are not set. +# serverroles (mandatory) Comma-separated list of servers that this +# component can install on. Valid values: +# mgtnode,servicenode,compute,login,storage,utility +# kitrepoid (mandatory) The ID of the kit package repository this +# component belongs to +# kitcompdeps (optional) Comma-separated list of kit component +# dependencies. These kit components can be included in +# this kit or in other kits. +# ospkgdeps (optional) Comma-separated list of OS package dependencies +# These packages must be shipped with the OS distro. +# kitpkgdeps (optional) Comma-separated list of kit package names that +# will be listed as "REQUIRES" when building this kit +# component. Each package must be defined in a separate +# kitpackage section. Each package must be in the same +# kitrepo as this kit component. +# non_native_pkgs (optional) +# Comma-separated list of non-native package +# paths that will be included as files in this kit +# component. All filenames are relative to +# /source_packages and may contain +# wildcards. If a filename is prefixed by 'EXTERNALPKGS:' +# the file will not be built into the kit tarfile, but +# will need to be added later with a 'buildkit addpkgs' +# command. +# Files will be placed in +# /opt/xcat/kits// +# when the kitcomponent package is deployed to an +# OS image. +# Kit component deployment scripts must be specified +# to manage these files. +# driverpacks (optional) Comma-separated list of driver package filenames +# Each driverpack must be defined in a separate kitpackage +# section. +# exlist (optional) Exclude list file for stateless image, relative +# to /other_files +# Kit component deployment scripts (optional) Each attribute specifies +# script path relative to /scripts +# Script attributes: +# preinstall, postinstall, preuninstall, postuninstall, +# preupgrade, postupgrade, postbootscripts, +# genimage_postinstall +kitcomponent: + basename=chef_server_kit + description=For installing chef server + version=1.0 + release=1 + serverroles=mgtnode + kitrepoid=rhels6_x86_64 + kitpkgdeps=chef-server + #postinstall=server.post + postbootscripts=server.post + +kitcomponent: + basename=chef_client_kit + description=For installing chef client + version=1.0 + release=1 + serverroles=compute + kitrepoid=rhels6_x86_64 + kitpkgdeps=chef + #postinstall=client.post + postbootscripts=client.post + +kitcomponent: + basename=chef_workstation_kit + description=For installing chef workstation + version=1.0 + release=1 + serverroles=compute + kitrepoid=rhels6_x86_64 + kitpkgdeps=chef + #postinstall=workstation.post + postbootscripts=workstation.post + + + +# kitpackage: This section defines one Kit Package, and how to build it. +# There can be zero or more kitpackage sections. +# All filenames should be relative paths to +# /source_packages +# If you want to build a package which can run on multiple OSes, +# you have two options: +# 1. Build a separate package for each OS you want to support. +# For this option, you need to define one kitpackage section +# per supported OS. +# 2. Build one package that can run on multiple OSes. +# If you are building an RPM package, you are responsible for +# creating an RPM spec file that can run on multiple OSes. +# For this option, you need to define one kitpackage section +# which contains multiple kitrepoid lines. +# +# kitpackage attributes: +# filename (mandatory) Package filename. +# kitrepoid (mandatory) A comma-separated list of kit reponames this package +# belongs to. If multiple repos are defined, the package will +# be built for the first repo only. For the other repos, +# a symlink is created to the package built for the first repo. +# Package build methods (optional) +# Define how to build the packages. +# If you don't specify a build method, the default behavior is +# to assume the package is pre-built under +# /source_packages +# All files in this section are relative to +# /source_packages +# There are four methods to build packages. +# 1. Use pre-built RPM package +# The filename may contain wildcards to avoid needing to +# specify an explicit package version-release filename. +# isexternalpkg: 'no'|'0', 'yes'|'1' (default: 'no') +# Indicates whether the RPM package will be added to the +# the kit tar file now as part of the kit build process, +# or whether the customer will need to separately +# obtain the RPM pacakage and add it to the kit tar file +# using 'buildkit addpkgs' +# rpm_prebuiltdir: If isexternalpkg=no, path to directory +# containing pre-built RPM package +# 2. Build RPM from spec + src dir +# rpm_spec: Path to spec file. +# rpm_srcdir: Path to source directory. +# 3. Build RPM from spec + src tarball +# rpm_spec: Path to spec file. +# rpm_srctarball: Path to source tarball. +# 4. Build RPM from source RPM +# rpm_srpm: Path to source RPM package. +kitpackage: + filename=chef-server-* + kitrepoid=rhels6_x86_64 + isexternalpkg=no + rpm_prebuiltdir=rhels6/x86_64 + +kitpackage: + filename=chef-11* + kitrepoid=rhels6_x86_64 + isexternalpkg=no + rpm_prebuiltdir=rhels6/x86_64 + +kitpackage: + filename=chef-11* + kitrepoid=rhels6_x86_64 + isexternalpkg=no + rpm_prebuiltdir=rhels6/x86_64 + + diff --git a/xCAT-buildkit/share/xcat/kits/kit_build/chef/chef-x86_64/scripts/client.post b/xCAT-buildkit/share/xcat/kits/kit_build/chef/chef-x86_64/scripts/client.post new file mode 100755 index 000000000..ccb067d53 --- /dev/null +++ b/xCAT-buildkit/share/xcat/kits/kit_build/chef/chef-x86_64/scripts/client.post @@ -0,0 +1,28 @@ +#!/bin/sh +# IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html + + +#------------------------------------------------------------------------------- +#=head1 client.post +#=head2 This command configures the chef client on a xCAT node. It is used +# as a post installation script for chef_client_kit.rpm. +#=cut +#------------------------------------------------------------------------------- +if [ "$NODESETSTATE" = "install" ]; then + #prevent getting called during full install bootup + #because the function will be called in the rpm %post section instead + exit 0 +else + if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image + #configure the chef client configuration files + /xcatpost/config_chef_client "$@" + fi +fi + +exit 0 + + + + + + diff --git a/xCAT-buildkit/share/xcat/kits/kit_build/chef/chef-x86_64/scripts/server.post b/xCAT-buildkit/share/xcat/kits/kit_build/chef/chef-x86_64/scripts/server.post new file mode 100755 index 000000000..7804dee92 --- /dev/null +++ b/xCAT-buildkit/share/xcat/kits/kit_build/chef/chef-x86_64/scripts/server.post @@ -0,0 +1,23 @@ +#!/bin/sh +# IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html + + +#------------------------------------------------------------------------------- +#=head1 server.post +#=head2 This command configures the chef server on a xCAT server or node. +# It is used as a post install script for chef_server_kit.rpm +#=cut +#------------------------------------------------------------------------------- +if [ "$NODESETSTATE" = "install" ]; then + #prevent getting called during full install bootup + #because the function will be called in the rpm %post section instead + exit 0 +else + if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image + #Now configure the chef server + /xcatpost/config_chef_server + fi +fi + +exit 0 + diff --git a/xCAT-buildkit/share/xcat/kits/kit_build/chef/chef-x86_64/scripts/workstation.post b/xCAT-buildkit/share/xcat/kits/kit_build/chef/chef-x86_64/scripts/workstation.post new file mode 100755 index 000000000..00b801978 --- /dev/null +++ b/xCAT-buildkit/share/xcat/kits/kit_build/chef/chef-x86_64/scripts/workstation.post @@ -0,0 +1,28 @@ +#!/bin/sh +# IBM(c) 2013 EPL license http://www.eclipse.org/legal/epl-v10.html + + +#------------------------------------------------------------------------------- +#=head1 workstation.post +#=head2 This command configures the chef workstation on a xCAT node. It is used +# as a post installation script for chef_workstation_kit.rpm. +#=cut +#------------------------------------------------------------------------------- +if [ "$NODESETSTATE" = "install" ]; then + #prevent getting called during full install bootup + #because the function will be called in the rpm %post section instead + exit 0 +else + if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image + #configure the chef workstation configuration files + /xcatpost/config_chef_workstation "$@" + fi +fi + +exit 0 + + + + + +