Forge Home

kickstart

A module to generate Kickstart configurations with Puppet.

24,697 downloads

21,154 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Support the Puppet Community by contributing to this module

You are welcome to contribute to this module by suggesting new features, currency updates, or fixes. Every contribution is valuable to help ensure that the module remains compatible with the latest Puppet versions and continues to meet community needs. Complete the following steps:

  1. Review the module’s contribution guidelines and any licenses. Ensure that your planned contribution aligns with the author’s standards and any legal requirements.
  2. Fork the repository on GitHub, make changes on a branch of your fork, and submit a pull request. The pull request must clearly document your proposed change.

For questions about updating the module, contact the module’s author.

Version information

  • 0.4.0 (latest)
  • 0.3.0
  • 0.2.0
  • 0.1.0
released Apr 6th 2016
This version is compatible with:
  • Puppet Enterprise 2023.8.x, 2023.7.x, 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
  • Puppet >= 3.0.0
  • ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'danzilio-kickstart', '0.4.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add danzilio-kickstart
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install danzilio-kickstart --version 0.4.0

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download
Tags: kickstart

Documentation

danzilio/kickstart — version 0.4.0 Apr 6th 2016

Kickstart

Puppet Forge Build Status Documentation Status

This module provides a primitive to generate a Kickstart file from Puppet data. This can be useful for Kickstarting physical or virtual machines. This module basically allows you to store your Kickstarts as structured data.

Support

This module only parses a template and generates a file, so it's conceivably universally compatible. Given that Kickstarts are generally only used to configure RedHat-like Linux systems, I've listed CentOS and RedHat in the module metadata.

Usage

You'll use the kickstart type to create Kickstart configurations. The title of the kickstart resource is a path where you want Puppet to place the file. The commands and parititon_configuration parameters accept a hash where the key is a string that represents the kickstart command and the value is a string or array of strings that represent arguments to that command. If you want a command to appear in the kickstart more than once, you can pass an array of arguments for each invocation. If you want a command to appear without arguments, you must set its value to true.

kickstart { '/var/www/html/kickstart.cfg':
  commands       => {
    'install'    => true,
    'text'       => true,
    'reboot'     => true,
    'skipx'      => true,
    'url'        => '--url http://mirror.centos.org/centos/6/os/x86_64',
    'lang'       => 'en_US.UTF-8',
    'keyboard'   => 'us',
    'network'    => '--device eth0 --bootproto dhcp',
    'rootpw'     => 'test1234',
    'firewall'   => '--disabled',
    'selinux'    => '--permissive',
    'authconfig' => '--enableshadow --enablemd5',
    'timezone'   => 'UTC',
    'bootloader' => '--location mbr',
  },
  parititon_configuration => {
    zerombr   => 'yes',
    clearpart => '--all --initlabel',
    part      => [
      '/boot --fstype ext3 --size 250',
      'pv.2 --size 5000 --grow',
    ],
    volgroup  => 'VolGroup00 --pesize 32768 pv.2',
    logvol    => [
      '/ --fstype ext4 --name LogVol00 --vgname VolGroup00 --size 1024 --grow',
      'swap --fstype swap --name LogVol01 --vgname VolGroup00 --size 256 --grow --maxsize 512'
    ]
  }
}

This would result in the following Kickstart:

### THIS FILE WAS GENERATED BY PUPPET ###

# Command Section
install
text
reboot
skipx
url --url http://mirror.centos.org/centos/6/os/x86_64
lang en_US.UTF-8
keyboard us
network --device eth0 --bootproto dhcp
rootpw test1234
firewall --disabled
selinux --permissive
authconfig --enableshadow --enablemd5
timezone UTC
bootloader --location mbr

# Partition Configuration
zerombr yes
clearpart --all --initlabel
part /boot --fstype ext3 --size 250
part pv.2 --size 5000 --grow
volgroup VolGroup00 --pesize 32768 pv.2
logvol / --fstype ext4 --name LogVol00 --vgname VolGroup00 --size 1024 --grow
logvol swap --fstype swap --name LogVol01 --vgname VolGroup00 --size 256 --grow --maxsize 512

This can get messy, so I recommend that you put this data into Hiera. You can pass arbitrary templates to the kickstart type for use in the pre or post installation sections using the fragments parameter. You must pass the fragments parameter a hash. The keys for the fragments hash must be the name of the section you want the fragment placed under (this is generally pre or post). The value for each section must be an array of paths to ERB templates.

kickstart { '/var/www/html/kickstart.cfg':
  fragments => {
    'post --interpreter /bin/bash' => [
      '/some/fully/qualified/path/configure_network.erb',
      'kickstart_profile/install_puppet.erb'
    ]
  }
}

You can pass your template fragments variables using the fragment_variables parameter. You can access those variables in your fragment templates using the @fragment_variables instance variable:

kickstart { '/var/www/html/kickstart.cfg':
  fragments => {
    'post --interpreter /bin/bash' => [
      '/some/fully/qualified/path/configure_network.erb',
      'kickstart_profile/install_puppet.erb'
    ]
  },
  fragment_variables => {
    'foo' => 'bar'
  }
}

You can pass a list of packages to install using the packages parameter, with an Array of packages:

kickstart { '/var/www/html/kickstart.cfg':
  packages => [
    '@base',
    'redhat-lsb',
    'apache',
    'mariadb-server',
    'nagios-nrpe'
  ]
}

This would result in the following snippet:

# Packages Section
%packages
@base
redhat-lsb
apache
mariadb-server
nagios-nrpe
%end

You can pass a list of packages, with options, to install using the packages parameter:

kickstart { '/var/www/html/kickstart.cfg':
  packages => {
    'options'      => '--nobase --ignoremissing',
    'package_list' => [
      '@core',
      'nagios-nrpe'
    ]
  }
}

This would result in the following snippet:

# Packages Section
%packages --nobase --ignoremissing
@core
nagios-nrpe
%end

You can also add repositories for use during installation using the repositories parameter:

kickstart { '/var/www/html/kickstart.cfg':
  repositories => {
    'base' => { 'baseurl' => 'http://mirror.centos.org/centos/6/os/x86_64' }
  }
}

This would result in the following snippet:

repo --name base --baseurl http://mirror.centos.org/centos/6/os/x86_64

This can get messy, so I recommend that you put this data into Hiera. You can pass arbitrary templates to the kickstart type for use in the pre or post installation sections using the addons parameter. You must pass the addons parameter a hash. The keys for the addons hash must be the name of the addon, and must include any options required. The value for each addon must be a srting or an array of data required by the addon.

You can configured addon with optional data, for use during installation, using the addons parameter.

e.g: CentOS 7 provides the Kdump add-on by default, which adds support for configuring kernel crash dumping during the installation. It's possible to write custom addons for Anaconda. Refer to documentation and the reference implementation.

kickstart { '/var/www/html/kickstart.cfg':
  addons => {
    'com_redhat_kdump --enable --reserve-mb="auto"' => []
    'my_addon_name --arg1 --arg2="value2"' => ['example1','example2','example3'],
  }
}

This would result in the folloiwng snippet:

# Addons Section
%addon com_redhat_kdump --enable --reserve-mb="auto"
%end

%addon my_addon_name --arg1 --arg2='value2'
example1
example2
example3
%end

Validation

By default, this module will validate your Kickstart commands against a list of valid commands; if you pass this type an invalid Kickstart command, it will fail to compile. The kickstart type checks to make sure that you're passing valid Kickstart commands based on this list. If you'd like to pass a command that isn't on that list, you can set the fail_on_unsupported_commands parameter to false:

kickstart { '/var/www/html/kickstart.cfg':
  fail_on_unsupported_commands => false,
  commands => {
    unsupported_commands => "I'm an unsupported command!"
  }
}

Development

  1. Fork it
  2. Create a feature branch
  3. Write a failing test
  4. Write the code to make that test pass
  5. Refactor the code
  6. Submit a pull request

We politely request (demand) tests for all new features. Pull requests that contain new features without a test will not be considered. If you need help, just ask!