HOWTO Set up a Post-Install environment for provisioning

HOWTO Set up a Post-Install environment for provisioning

From Consultancy.EdVoncken.NET

Jump to: navigation, search

Contents

After Cobbler installs the new host, various Post-Install activities can be performed in the %post section. I use HTTP to download all Pre- and Post-Install scripts to the new host. This offers maximum performance and flexibility, as content can be dynamically generated if necessary.

The HTTP protocol ensures that we can use a single Provisioning server across the enterprise since HTTP easily travels across network boundaries.

In a future version, I will probably rewrite the entire Post-Install using either Puppet or Cfengine, making most (or all) of these scripts obsolete.

[edit] Webserver configuration

The standard Apache configuration is sufficient for serving out all Post-Install scripts and hooks.

All scripts are made available under /var/www/html/postinstall/bin/ (${POST_PATH}/bin/).

Hooks are made available under /var/www/html/postinstall/hook/ (${POST_PATH}/${POST_HOOK}/), in the appropriate customer/, site/, distro/, profile/, and system/ subdirectories.

[edit] Post Installation

[edit]  %pre

The %pre section is executed before starting the actual installation.

This section can be used to dynamically determine disk layout, for example by generating a Kickstart snippet that is included by the Kickstart file (%include /tmp/layout). Currently, I do not have custom %pre scripts.

[edit]  %post-nochroot

The %post-nochroot section is executed after package installation, but without chroot()ing to /mnt/sysimage.

I only use this section to rescue temporary files left during the %pre section, as a debugging aid.

[edit]  %post

The %post section is executed after package installation, after chroot()ing to /mnt/sysimage.

This section contains my main Post-Install scripts, and globally performs the following:

  1. Export global settings
  2. Export custom settings for Customer/Site/Distro/Profile/System
  3. Start main Postinstall script

Global variables are:

 POST_SERVER - Name or IP-address of the Provisioning Server
 POST_PATH - Path to postinstall scripts on the webserver, appended to $POST_SERVER
 POST_HOOK - Path to postinstall hooks on the webserver, appended to $POST_PATH
 
 POST_CUSTOMER - Name of the customer or organization, defaults to "default"
 POST_SITE - Name of the site or location for this customer, defaults to "default"
 POST_DISTRO - Name of the installation distribution, defaults to "default"
 POST_PROFILE - Name of the installation profile, defaults to "default"
 POST_SYSTEM - Name of the system, defaults to "default"

The main postinstall script uses these POST_ variables to locate and execute the proper post-installation scripts.

[edit] Navigation