Skip to content

Instantly share code, notes, and snippets.

@arubdesu
Created September 28, 2012 04:21
Show Gist options
  • Save arubdesu/cfcc41ed72d18ad366f0 to your computer and use it in GitHub Desktop.
Save arubdesu/cfcc41ed72d18ad366f0 to your computer and use it in GitHub Desktop.
puppet module for running the netboot service on mac client
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NetBoot</key>
<dict/>
<key>allow</key>
<array/>
<key>bootp_enabled</key>
<true/>
<key>deny</key>
<array/>
<key>detect_other_dhcp_server</key>
<true/>
<key>dhcp_enabled</key>
<false/>
<key>netboot_enabled</key>
<array>
<string>en0</string>
</array>
<key>old_netboot_enabled</key>
<false/>
<key>relay_enabled</key>
<false/>
<key>relay_ip_list</key>
<array/>
<key>startTime</key>
<string>2012-05-18 14:08:56 -0400</string>
</dict>
</plist>
<%= root_dir %>/NetBootSP0 -ro -maproot=root
<%= root_dir %>/NetBootClients0 -ro -maproot=root
# /etc/puppet/modules/macnetboot/manifests.init.pp
class macnetboot (
$root_dir = $macnetboot::params::root_dir
) inherits macnetboot::params{
file { '/private/etc/exports':
ensure => present,
group => '0',
mode => '0644',
owner => '0',
content => template('macnetboot/exports.erb'),
# wouldn't it be nice if this worked?
# notify => Service['/System/Library/LaunchDaemons/bootps.plist'],
}
file { $root_dir:
ensure => 'directory',
group => '80',
mode => '0775',
owner => '0',
}
file { "${root_dir}/NetBootClients0":
ensure => 'directory',
group => '80',
mode => '0775',
owner => '0',
}
file { "${root_dir}/NetBootSP0":
ensure => 'directory',
group => '80',
mode => '0775',
owner => '0',
}
file { '/private/tftpboot/NetBoot':
ensure => 'directory',
group => '80',
mode => '0755',
owner => '0',
}
file { '/private/tftpboot/NetBoot/NetBootSP0':
ensure => 'link',
target => "${root_dir}/NetBootSP0",
}
file { "${root_dir}/.clients":
ensure => 'link',
target => 'NetBootClients0',
}
file { "${root_dir}/.sharepoint":
ensure => 'link',
target => 'NetBootSP0',
}
file { '/System/Library/LaunchDaemons/tftp.plist':
ensure => 'file',
source => 'puppet:///modules/macnetboot/tftp.plist',
group => '0',
mode => '0644',
owner => '0',
}
file { '/private/etc/bootpd.plist':
ensure => 'file',
source => 'puppet:///modules/macnetboot/bootpd.plist',
group => '0',
mode => '0644',
owner => '0',
}
# as stated previously, does not work
# service { '/System/Library/LaunchDaemons/bootps.plist':
# ensure => running,
# enable => true,
# require => [File['/private/etc/bootpd.plist']],
# }
}
# /etc/puppet/modules/manifests/params.pp
class macnetboot::params {
# root directory of the netboot sets
$root_dir = "/Library/NetBoot"
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<true/>
<key>InitGroups</key>
<true/>
<key>Label</key>
<string>com.apple.tftpd</string>
<key>ProgramArguments</key>
<array>
<string>/usr/libexec/tftpd</string>
<string>-i</string>
<string>/private/tftpboot</string>
</array>
<key>Sockets</key>
<dict>
<key>Listeners</key>
<dict>
<key>SockServiceName</key>
<string>tftp</string>
<key>SockType</key>
<string>dgram</string>
</dict>
</dict>
<key>inetdCompatibility</key>
<dict>
<key>Wait</key>
<true/>
</dict>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment