Skip to content

Instantly share code, notes, and snippets.

@danzilio
Created January 7, 2016 16:20
Show Gist options
  • Save danzilio/82995742eb714705d854 to your computer and use it in GitHub Desktop.
Save danzilio/82995742eb714705d854 to your computer and use it in GitHub Desktop.
First stab at converting your kickstart
define community_kickstarts::centos (
$rootpw = '--plaintext changeme',
$url = 'http://mirror.centos.org/centos/7/os/x86_64',
$architecture = 'x86_64',
$lang = 'en_US.UTF-8',
$keyboard = 'us',
$network = '--onboot yes --device eth0 --bootproto dhcp --hostname kickstarted.example.com',
$firewall = '--service=ssh',
$authconfig = '--enableshadow --passalgo=sha512',
$selinux = '--enforcing',
$timezone = '--utc Etc/UTC',
$bootloader = '--location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"',
$post_log = '/root/ks-post.log',
$post_fragments = ['community_kickstarts/install_puppet.erb'],
$puppet_repo = 'https://yum.puppetlabs.com/el/7/products/x86_64/puppetlabs-release-7-11.noarch.rpm',
$repos = {},
$partition_configuration = {},
$additional_packages = [],
$post_fragments = [],
$additional_commands = {},
$required_packages = [
'@core',
'@server-policy',
'ntpdate',
'ntp',
'wget',
'screen',
'git',
'perl',
'openssh-clients',
'man',
'system-config-network-tui',
'mlocate',
'bind-utils',
'traceroute',
'mailx',
],
) {
$autopart = empty($partition_configuration)
$base_repo = { base => { baseurl => $url } }
$commands = {
install => true,
url => $url,
lang => $lang,
keyboard => $keyboard,
cmdline => true,
network => $network,
rootpw => $rootpw,
firewall => $firewall,
authconfig => $authconfig,
selinux => $selinux,
timezone => $timezone,
autopart => $autopart,
bootloader => $bootloader,
reboot => true,
}
$fragments = {
"post --log ${post_log}" => $post_fragments
}
::kickstart { $name:
packages => unique(concat($additional_packages, $required_packages)),
commands => merge($commands, $additional_commands),
partition_configuration => $partition_configuration,
repos => merge($base_repo, $repos),
fragments => $fragments,
}
}
@rnelson0
Copy link

rnelson0 commented Jan 7, 2016

[root@testbox modules]# puppet apply -e "community_kickstarts::centos{'/root/test.ks':}"
Notice: Compiled catalog for testbox.nelson.va in environment production in 0.74 seconds
Notice: /Stage[main]/Main/Community_kickstarts::Centos[/root/test.ks]/Kickstart[/root/test.ks]/File[/root/test.ks]/ensure: created
Notice: Finished catalog run in 0.02 seconds

[root@testbox modules]# cat /root/test.ks
### THIS FILE WAS GENERATED BY PUPPET ###

# Command Section
install
url http://mirror.centos.org/centos/7/os/x86_64
lang en_US.UTF-8
keyboard us
cmdline
network --onboot yes --device eth0 --bootproto dhcp --hostname kickstarted.example.com
rootpw --plaintext changeme
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
selinux --enforcing
timezone --utc Etc/UTC
autopart
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
reboot

# Package Repositories
repo --name base --baseurl http://mirror.centos.org/centos/7/os/x86_64


# Packages Section
%packages
@core
@server-policy
ntpdate
ntp
wget
screen
git
perl
openssh-clients
man
system-config-network-tui
mlocate
bind-utils
traceroute
mailx
%end

%post --log /root/ks-post.log
%end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment