Skip to content

Commit

Permalink
machine-types/core refactoring to make it more flexible
Browse files Browse the repository at this point in the history
- Initial part factored out in a separate template, core-init.pan, to allow
execution of site specific actions between this initial part and the core configuration
- Ability to delay some part of the configuration, like file systems, in case some site
information must be defined before
- Hook to configure time synchronisation according to site needs (ntp, chrony...)
- Template cleanup
  • Loading branch information
jouvin committed Oct 27, 2021
1 parent 4f427d6 commit 4daa96e
Show file tree
Hide file tree
Showing 6 changed files with 340 additions and 328 deletions.
45 changes: 45 additions & 0 deletions machine-types/core-init.pan
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This template initialises the variables related to the site, cluster and the host.
# Factorised from core.pan to adresse use cases where some configuration is
# needed between this part and the main part of the OS configuration.

template machine-types/core-init;

# Include static information and derived global variables.
variable SITE_DB_TEMPLATE ?= 'site/databases';
include SITE_DB_TEMPLATE;
variable SITE_GLOBAL_VARS_TEMPLATE ?= 'site/global_variables';
include SITE_GLOBAL_VARS_TEMPLATE;

# define site functions
variable SITE_FUNCTIONS_TEMPLATE ?= if_exists('site/functions');
include SITE_FUNCTIONS_TEMPLATE;

# Package management core functions
include 'components/spma/functions';

# profile_base for profile structure
include 'quattor/profile_base';

# hardware
include 'hardware/functions';
"/hardware" = if ( exists(DB_MACHINE[escape(FULL_HOSTNAME)]) ) {
create(DB_MACHINE[escape(FULL_HOSTNAME)]);
} else {
error(FULL_HOSTNAME + " : hardware not found in machine database");
};
variable MACHINE_PARAMS_CONFIG ?= undef;
include MACHINE_PARAMS_CONFIG;
"/hardware" = if ( exists(MACHINE_PARAMS) && is_dict(MACHINE_PARAMS) ) {
update_hw_params();
} else {
SELF;
};


# Cluster specific configuration
variable CLUSTER_INFO_TEMPLATE ?= 'site/cluster_info';
include CLUSTER_INFO_TEMPLATE;


# Select OS version based on machine name
include 'os/version';
141 changes: 45 additions & 96 deletions machine-types/core.pan
Original file line number Diff line number Diff line change
@@ -1,70 +1,38 @@
############################################################
#
# template machine-types/core
#
# Defines bare minimum configuration (core) for a node.
#
# RESPONSIBLE: Christos Triantafyllidis <[email protected]>
#
############################################################
# This template is the core template used to configure the OS and the basic services.

template machine-types/core;

# Include static information and derived global variables.
variable SITE_DB_TEMPLATE ?= if_exists('pro_site_databases');
variable SITE_DB_TEMPLATE ?= 'site/databases';
include { SITE_DB_TEMPLATE };
variable SITE_GLOBAL_VARS_TEMPLATE ?= if_exists('pro_site_global_variables');
variable SITE_GLOBAL_VARS_TEMPLATE ?= 'site/global_variables';
include { SITE_GLOBAL_VARS_TEMPLATE };

#
# define site functions
#
variable SITE_FUNCTIONS_TEMPLATE ?= if_exists('site/functions');
variable SITE_FUNCTIONS_TEMPLATE ?= if_exists('pro_site_functions');
include { SITE_FUNCTIONS_TEMPLATE };
# Core initializations related to host hardware, cluster and global site variables
# Can be called before executing this template when some specific configurations
# need to be done before configure the OS but require this initial part
include 'machine-types/core-init';

#
# profile_base for profile structure
#
include { 'quattor/profile_base' };

#
# NCM core components
#
include { 'components/spma/config' };
include { 'components/grub/config' };
@{
desc = when, true, don't do the filesystem/blockdevice configuration as part of the OS configuration
value = boolean
default = false
required = no
}
variable OS_POSTPONE_FILESYSTEM_CONFIG ?= false;
variable DEBUG = debug('OS_POSTPONE_FILESYSTEM_CONFIG=%s', OS_POSTPONE_FILESYSTEM_CONFIG);

@{
desc = when, true, don't do the AII configuration as part of the OS configuration
value = boolean
default = OS_POSTPONE_FILESYSTEM_CONFIG (AII configuration must be done after the file system configuration)
required = no
}
variable OS_POSTPONE_AII_CONFIG ?= OS_POSTPONE_FILESYSTEM_CONFIG;
variable DEBUG = debug('%s: OS_POSTPONE_AII_CONFIG=%s', OS_POSTPONE_AII_CONFIG);

#
# hardware
#
include { 'hardware/functions' };
"/hardware" = if ( exists(DB_MACHINE[escape(FULL_HOSTNAME)]) ) {
create(DB_MACHINE[escape(FULL_HOSTNAME)]);
} else {
error(FULL_HOSTNAME + " : hardware not found in machine database");
};
variable MACHINE_PARAMS_CONFIG ?= undef;
include { MACHINE_PARAMS_CONFIG };
"/hardware" = if ( exists(MACHINE_PARAMS) && is_nlist(MACHINE_PARAMS) ) {
update_hw_params();
} else {
SELF;
};


# Cluster specific configuration
variable CLUSTER_INFO_TEMPLATE ?= if_exists('pro_site_cluster_info');
variable CLUSTER_INFO_TEMPLATE ?= 'site/cluster_info';
include { CLUSTER_INFO_TEMPLATE };

# Grub configuration module initialisation
include 'components/grub/config';

# common site machine configuration
variable SITE_CONFIG_TEMPLATE ?= if_exists('pro_site_config');
variable SITE_CONFIG_TEMPLATE ?= 'site/config';
include { SITE_CONFIG_TEMPLATE };
include SITE_CONFIG_TEMPLATE;


# File system configuration.
Expand All @@ -75,77 +43,58 @@ variable FILESYSTEM_LAYOUT_CONFIG_SITE ?= if_exists("site/filesystems/base");
variable FILESYSTEM_LAYOUT_CONFIG_SITE ?= error("No file system layout template defined");
variable FILESYSTEM_CONFIG_SITE ?= 'filesystem/config';

# Select OS version based on machine name
include { 'os/version' };

variable OS_TEMPLATE_NAMESPACE = true;


# Define OS related namespaces
variable OS_NS_ROOT = 'config/';
variable OS_NS_OS = OS_NS_ROOT + 'os/';
variable OS_NS_CONFIG ?= if ( is_defined(if_exists(OS_NS_ROOT+'os/base')) ) {
OS_NS_ROOT + 'os/';
} else {
OS_NS_ROOT + 'core/';
};
variable OS_NS_OS = OS_NS_ROOT + 'core/';
variable OS_NS_CONFIG ?= OS_NS_ROOT + 'core/';
variable OS_NS_QUATTOR = OS_NS_ROOT + 'quattor/';
variable OS_NS_REPOSITORY ?= 'repository/';
#

# software packages
#
include { 'pan/functions' };
include 'pan/functions';

#
# Configure Bind resolver
#
include { 'site/named' };
include 'site/named';


#
# Include OS version dependent RPMs
#
variable SERVICE_OS_BASE_TEMPLATE = {
if ( is_defined(OS_NS_CONFIG) ) {
OS_NS_CONFIG + "base";
} else {
undef;
};
if ( is_defined(OS_NS_CONFIG) ) {
OS_NS_CONFIG + "base";
} else {
undef;
};
};
include { SERVICE_OS_BASE_TEMPLATE };
include SERVICE_OS_BASE_TEMPLATE;

# Configure time synchonisation
include if_exists('site/time_synchronisation');

#
# Quattor client software
#
include { 'quattor/client/config' };
include 'quattor/client/config';


# Configure filesystem layout.
# Must be done after NFS initialisation as it may tweak some mount points.
include { return(FILESYSTEM_CONFIG_SITE) };
include if ( !OS_POSTPONE_FILESYSTEM_CONFIG ) FILESYSTEM_CONFIG_SITE;

#
# AII component must be included after much of the other setup.
#
include { OS_NS_QUATTOR + 'aii' };
include if ( !OS_POSTPONE_AII_CONFIG ) OS_NS_QUATTOR + 'aii';


#
# Add local users if some configured
#
variable USER_CONFIG_INCLUDE = if ( exists(USER_CONFIG_SITE) && is_defined(USER_CONFIG_SITE) ) {
return('users/config');
} else {
return(null);
};
include { USER_CONFIG_INCLUDE };
'users/config';
} else {
null;
};
include USER_CONFIG_INCLUDE;

#
# Add site specific configuration if any
#
variable GLITE_BASE_CONFIG_SITE ?= null;
include GLITE_BASE_CONFIG_SITE;

# Default repository configuration template
variable PKG_REPOSITORY_CONFIG ?= 'repository/config';
5 changes: 5 additions & 0 deletions machine-types/frontier.pan
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@

template machine-types/frontier;

# UMD site configuration
variable GLITE_BASE_CONFIG_SITE ?= undef;

# CREATE_HOME must be defined as undef
variable CREATE_HOME ?= undef;

include 'machine-types/core';

include GLITE_BASE_CONFIG_SITE;

include 'features/frontier/config';

Loading

0 comments on commit 4daa96e

Please sign in to comment.