Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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:

deploy1-centos5.erb

....
install=http://.../$arch/...
repo=http://.../$arch/...
....

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

1 Answer 1

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

 
discard

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.