Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I maintain a library of different kickstart configurations, mostly for CentOS 5 and 6. It has recently gotten to the point I want to deduplicate as much of this information as possible.

I am aware of a couple options out there which can dynamically generate kickstart files. Not interested at this point unless I really need to do that route. I would like to create my Kickstart files using a template along the following line:



My output naming schema is "deploy1-centos5-x86_64".

I'd like to be able to create several kickstart files from a given template, one for 32 bit, one 64, ppc, etc. This would work perfectly if I could readily set the value of arch per each time the template is called to create a file.

What is the most ready way to address this?

share|improve this question
up vote 4 down vote accepted

The simplest pattern is to create a define that'll spit out the file you want based on your inputs.

define kickstart::config ($os, $arch) {

# $name is a reserved variable, it works based on the name of this define
# kickstart::configs { "this_becomes_name": }

  file { "kickstart/conf.d/${name}-${os}-${arch}":
    ensure  => present,
    content => template("kickstart/conf.d/${name}.erb"),
    #content => template("kickstart/conf.d/${name}-${os}.erb"),
    #content => template("kickstart/conf.d/${name}-${os}-${arch}.erb"),
    # or whatever, but this template file will need to exists. 


and then apply like

kickstart::config { 'deploy1':
  arch => 'i386',
  os   => 'centos5',
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.