Prepostvar

From Grid5000

Jump to: navigation, search

Prepostvar refers to variables that contains site-specific information. Prepostvars are stored into the preinstall archive, which is already site-dependent. They are used into postinstall archive, to adapt a deployed environment to the site where it is currently deployed.

Contents

Files of variables

Depending on their use or on the moment they can be instanciated, Prepostvars are stored into 2 distinct files:

  • prevar-X.Y.ash: preinstall required variable list, version X.Y
  • postvar-X.Y.ash: postinstall required variable list, version X.Y

Each variable list possesses a version number X.Y. Version number tells us what variables are present in the list. Version number is part of variable list file name to strongly bind a postinstall to one definition of variable list. This way, postinstall will not be affected by variable changes, because administrator garanties to put each variable list version into preinstall's archive.

prevar.ash content is sourced by postvar.ash, because some preinstall's variables are required during postinstall. The opposite cannot be done, because many postinstall's variables cannot be instanciated before postinstall step: they need the deployed system to be installed on destination partition.

Available variables

_RELEASE

Release number of variable list.

  • Example: nancy3
  • Default: cannot be guessed
  • For: preinstall, postinstall
  • Available on version: 1.0

In addition to _VERSION, variable list possesses a release number that reflects the values attributed by the site. With relase number, user can be aware of value's changes.

_VERSION

Version number of variable list.

  • Example: 1.0
  • Default: cannot be guessed
  • For: preinstall, postinstall
  • Available on version: 1.0

Version of the present variable list. To a given version corresponds a given variable's name list, so when a postinstall script load a given version of postvar list, it is sure to find values for variables existing at this version.

A given postvar version can only be associated to the prevar of the same version number. _VERSION is formed with a major number and a minor number, corresponding to those used to name the variable list file.

CP_OPTS

What are the options to pass to the cp command to copy data tree.

  • Special: must be initialized by postinst script before loading variable's files
  • For: postinstall
  • Available on version: 1.0

DEST_DIR

On which directory was the deployed system image mounted ?

  • Value: /mnt/dest
  • Special: not to be modified
  • For: postinstall
  • Available on version: 1.0

DISTRIB

Linux distribution name

  • Default:
if [ -f $DEST_DIR/etc/lsb-release ]; then
  DISTRIB=$(grep DISTRIB_ID $DEST_DIR/etc/lsb-release | sed -e 's|^.*=||' -e 'y|U|u|'
fi

if [ -z "$DISTRIB" ]; then
  if [ -f $DEST_DIR/etc/debian_version ]; then
    DISTRIB='debian'
  elif [ -f $DEST_DIR/etc/fedora-release ]; then
    DISTRIB='fedora'
  elif [ -f $DEST_DIR/etc/redhat-release ]; then
    DISTRIB='redhat'
  elif [ -f $DEST_DIR/etc/rocks-release ]; then
    DISTRIB='rocks'
  else
    DISTRIB='unknown'
  fi
fi
  • May depend: DEST_DIR
  • For: postinstall
  • Available on version: 1.0

NET_IFTAB

Network interface name mapping

  • Default:
if [ -e $NODE_DIR/etc/iftab ]; then
  NET_IFTAB=$(cat $NODE_DIR/etc/iftab)
else
  NET_IFTAB=$(ifconfig -a | grep HWaddr | sed -e 's|Link.*HWaddr|mac|')
fi
  • May depend: NODE_DIR
  • For: postinstall
  • Available on version: 1.0

NFS_MOUNT

fstab mount point definition to get home directory data and/or specific software.

  • Example: nfs.nancy.grid5000.fr:/export/home /home nfs rw,rsize=8192,wsize=8192,hard,intr,sync,nodev,nosuid,auto 0 0
  • Default: cannot be guessed
  • For: postinstall
  • Available on version: 1.0

This variable is optional because it is generally not a good idea to mount NFS-things on a deployed system. This variable can possess an empty value. Moreover, NFS_MOUNT is liable to vary depending on targeted deploy partition. This way, we can prohibit deployed system from using NFS-mounts while authorizing our reference system to use them:

if [ "$ROOT_PART" = "$REF_ROOT_PART" ]; then
  NFS_MOUNT='nfs.nancy.grid5000.fr:/export/home /home nfs ...'
else
  NFS_MOUNT=""
fi
Image:Note.png Note

This variable can contain multiple NFS mount points.

If no NFS partition is available, it is a good idea to put a commentary in variable instead, to warn about it:

NFS_MOUNT='# no NFS export available'

NODE_DIR

Directory that contains node specific configuration data tree. This can be a common directory for all site's nodes or one directory per node, depending of site needs. Moreover, NODE_DIR' content can vary depending on targeted deploy partition. This way, we can adapt files to copy to deployed system if it is the reference system or not, like copying OAR configuration files.

  • Default:
# node specific configuration data tree
NODE_DIR=$PREPOST_DIR/dest

# node's directories to copy
_tmp_dir_list="$PREPOST_DIR/nodes"
if [ "$ROOT_PART" = "$REF_ROOT_PART" ]; then
  _tmp_dir_list="$_tmp_dir_list $PREPOST_DIR/nodes-ref"
fi

for _tmp_dir in $_tmp_dir_list; do
  # merge generic and distrib-specific dirs to mask complexity
  [ -d $_tmp_dir/generic ] && cp $CP_OPTS $_tmp_dir/generic/* $NODE_DIR
  [ -d $_tmp_dir/$DISTRIB ] && cp $CP_OPTS $_tmp_dir/$DISTRIB/* $NODE_DIR
done
Image:Note.png Note

If your nodes have individual SSH host keys, then you can use this directory to store each keys independently.

NODE_OWN

File that contains specific ownership definitions.

  • Default:
# node specific ownership definitions
NODE_OWN=$PREPOST_DIR/dest.own

# node's directories to copy
_tmp_dir_list="$PREPOST_DIR/nodes"
if [ "$ROOT_PART" = "$REF_ROOT_PART" ]; then
  _tmp_dir_list="$_tmp_dir_list $PREPOST_DIR/nodes-ref"
fi

for _tmp_dir in $_tmp_dir_list; do
  # merge generic and distrib-specific owner files to mask complexity
  [ -s $_tmp_dir/generic.own ] && cat $_tmp_dir/generic.own >>$NODE_OWN
  [ -s $_tmp_dir/$DISTRIB.own ] && cat $_tmp_dir/$DISTRIB.own >>$NODE_OWN
done

PREPOST_DIR

In which directory were the prepost data unpacked ?

  • Special: must be initialized by postinst script before loading variable's files
  • For: postinstall
  • Available on version: 1.0

PROXY_AVAILABILITY

Is a web proxy server available? If no proxy available, this variable must be equal to '#' to disable the related configurations, for instance /etc/environment

  • Example: '#'
  • Default: cannot be guessed
  • Special: values can only be '#' or ''
  • For: postinstall
  • Available on version: 1.0

REF_ROOT_PART

The partition that contains reference environment. With this variable, we can adapt other variable values to apply specific treatment to reference environment, like a specific NODE_DIR to copy.

  • Default: ${ROOT_DEVICE}2
  • May depend: ROOT_DEVICE
  • For: preinstall, postinstall
  • Available on version: 1.0

ROOT_DEVICE

Disk targeted during deployment

  • Example: /dev/sda
  • Default: cannot be easily guessed because of device like cciss where partition is /dev/cciss/c0d0p1 whereas disk is /dev/cciss/c0d0
  • For: preinstall, postinstall
  • Available on version: 1.0

ROOT_FSTYPE

Filesystem type of the partition targeted during deployment

  • Default: $(mount | grep "on $DEST_DIR " | sed -e 's|^.*type \(\w*\) .*$|\1|')
  • May depend: DEST_DIR
  • For: postinstall
  • Available on version: 1.0

ROOT_PART

Partition targeted during deployment

  • Default: $(mount | grep "on $DEST_DIR " | sed -e 's| .*$||')
  • Special: not to be modified
  • May depend: DEST_DIR
  • For: postinstall
  • Available on version: 1.0

SCRATCH_FSTYPE

Filesystem type of the scratch partition

  • Example: ext2
  • Default: cannot be guessed
  • Special: can possess an empty value (scratch partition is not available on every site)
  • For: preinstall, postinstall
  • Available on version: 1.0

SCRATCH_MOUNT

fstab mount point definition for /scratch.

  • Default: $SCRATCH_PART /scratch $SCRATCH_FSTYPE defaults 0 0
  • Special: can possess an empty value (scratch partition is not available on every site)
  • May depend: SCRATCH_PART
  • For: postinstall
  • Available on version: 1.0

If no local scratch partition is available, it is a good idea to put a commentary in variable instead, to warn about it:

SCRATCH_MOUNT='# no local scratch partition available'

SCRATCH_PART

Partition device used for scratch

  • Example: /dev/sda10
  • Default: cannot be guessed
  • Special: can possess an empty value (scratch partition is not available on every site)
  • For: preinstall, postinstall
  • Available on version: 1.0

SWAP_PART

Partition device used for swap

  • Default: $(fdisk -l $ROOT_DEVICE | grep swap | sed -e 's| .*$||')
  • Special: not to be modified
  • May depend: ROOT_DEVICE
  • For: preinstall, postinstall
  • Available on version: 1.0

SITE

Grid'5000 site's name.

  • Example: sophia
  • Default: do not have to be guessed
  • For: postinstall
  • Available on version: 1.0

SITE_AUTH_KEYS

Public keys of site's root and deploy users. Needed to perform system administration tasks.

  • Default: $PREPOST_DIR/authorized_keys
  • May depend: PREPOST_DIR
  • For: postinstall
  • Available on version: 1.0

TMP_FSTYPE

Filesystem type of the tmp partition

  • Example: ext2
  • Default: cannot be guessed
  • Special: can possess an empty value (tmp partition is not available on every site)
  • For: preinstall, postinstall
  • Available on version: 1.0

TMP_MOUNT

fstab mount point definition for /tmp.

  • Default: $TMP_PART /tmp $TMP_FSTYPE defaults 0 0
  • Special: can possess an empty value (tmp partition is not available on every site)
  • May depend: TMP_PART, TMP_FSTYPE
  • For: postinstall
  • Available on version: 1.0

If no local temporary partition is available, it is a good idea to put a commentary in variable instead, to warn about it:

TMP_MOUNT='# no local tmp partition available'

TMP_PART

Partition device used for tmp

  • Default: ${ROOT_DEVICE}5
  • Special: can possess an empty value (tmp partition is not available on every site)
  • For: preinstall, postinstall
  • Available on version: 1.0

TTYS_AVAILABILITY

If no remote console is available, we need a '#' character to disable remote console in configuration files like /etc/inittab

  • Value: $([ -z "$TTYS_NAME" ] && echo '#')
  • Special: values can only be '#' or ''
  • May depend: TTYS_NAME
  • For: postinstall
  • Available on version: 1.0

TTYS_NAME

Remote console device filename

  • Example: ttyS0
  • Default: cannot be guessed
  • Special: can possess an empty value (remote console is not available on every site)
  • For: postinstall
  • Available on version: 1.0

TTYS_SPEED

Remote console device speed

  • Default: 38400
  • Special: can possess an empty value (remote console is not available on every site)
  • For: postinstall
  • Available on version: 1.0

Implementations

Version 1.0

Bordeaux Grenoble Lille Lyon Nancy Orsay Rennes Sophia Toulouse

pre, post

idpot
pre, post
icluster2
pre, post
icare
pre, post

pre, post

capricorne
pre, post
sagittaire
pre, post

pre, post

pre, post

paraci
pre, post
parasol
pre, post
paravent
pre, post
tartopom
pre, post
azur
pre, post
helios
pre, post

pre, post

Requirements

For prepost files of variables to load well, some command line tools must be provided by deployment system. Following commands are commonly used among these script files to compute variable values:

ash, cat, chroot, cp, fdisk, grep, ifconfig, ls, mkdir, mount, rm, sed

Note: prepost's variables maintainer are advised to only use above commands in their files of variables. Using other commands means to rebuild preinstall's archive to insert these command's binaries into the archive.

Personal tools
Wiki special pages