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?


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',
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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