Project

General

Profile

Download (6.11 KB) Statistics
| Branch: | Tag: | Revision:
<%#
kind: provision
name: Preseed default
oses:
- Debian 6.0
- Debian 7.
- Debian 8.
- Ubuntu 10.04
- Ubuntu 12.04
- Ubuntu 13.04
- Ubuntu 14.04
%>
<%
# safemode renderer does not support unary negation
pm_set = @host.puppetmaster.empty? ? false : true
proxy_string = @host.params['http-proxy'] ? " http://#{@host.params['http-proxy']}:#{@host.params['http-proxy-port']}" : ''
puppet_enabled = pm_set || @host.params['force-puppet'] && @host.params['force-puppet'] == 'true'
salt_enabled = @host.params['salt_master'] ? true : false
%>
# Locale
d-i debian-installer/locale string <%= @host.params['lang'] || 'en_US' %>
# country and keyboard settings are automatic. Keep them ...
# ... for wheezy and newer:
d-i keyboard-configuration/xkb-keymap seen true
# ... for squeeze and older:
d-i console-keymaps-at/keymap seen true

<% subnet = @host.subnet -%>
<% if subnet.respond_to?(:dhcp_boot_mode?) -%>
<% dhcp = subnet.dhcp_boot_mode? && !@static -%>
<% else -%>
<% dhcp = !@static -%>
<% end -%>
<% unless dhcp -%>
# Static network configuration.
d-i preseed/early_command string /bin/killall.sh; /bin/netcfg
d-i netcfg/disable_autoconfig boolean true
d-i netcfg/dhcp_failed note
d-i netcfg/dhcp_options select Configure network manually
d-i netcfg/disable_dhcp boolean true
d-i netcfg/get_ipaddress string <%= @host.ip %>
d-i netcfg/get_netmask string <%= subnet.mask %>
d-i netcfg/get_nameservers string <%= [subnet.dns_primary,subnet.dns_secondary].reject{|n| n.blank?}.join(' ') %>
d-i netcfg/get_gateway string <%= subnet.gateway %>
d-i netcfg/confirm_static boolean true
<% end -%>

# Network configuration
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string <%= @host %>
d-i netcfg/get_domain string <%= @host.domain %>
d-i netcfg/wireless_wep string

d-i hw-detect/load_firmware boolean true

# Mirror settings
d-i mirror/country string manual
d-i mirror/http/hostname string <%= @preseed_server %>
d-i mirror/http/directory string <%= @preseed_path %>
d-i mirror/http/proxy string<%= proxy_string %>
d-i mirror/codename string <%= @host.operatingsystem.release_name %>
d-i mirror/suite string <%= @host.operatingsystem.release_name %>
d-i mirror/udeb/suite string <%= @host.operatingsystem.release_name %>

# Time settings
d-i clock-setup/utc boolean true
d-i time/zone string <%= @host.params['time-zone'] || 'UTC' %>

# NTP
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string <%= @host.params['ntp-server'] || '0.debian.pool.ntp.org' %>

# Set alignment for automatic partitioning
# Choices: cylinder, minimal, optimal
#d-i partman/alignment select cylinder

<%= @host.diskLayout %>

# Install different kernel
#d-i base-installer/kernel/image string linux-server

# User settings
d-i passwd/root-password-crypted password <%= root_pass %>
user-setup-udeb passwd/root-login boolean true
d-i passwd passwd/make-user boolean false
user-setup-udeb passwd/make-user boolean false

<% repos = 0 %>
<% if puppet_enabled && @host.params['enable-puppetlabs-repo'] && @host.params['enable-puppetlabs-repo'] == 'true' -%>
# Puppetlabs products
d-i apt-setup/local<%= repos %>/repository string \
http://apt.puppetlabs.com <%= @host.operatingsystem.release_name %> main
d-i apt-setup/local<%= repos %>/comment string Puppetlabs products
d-i apt-setup/local<%= repos %>/source boolean true
d-i apt-setup/local<%= repos %>/key string http://apt.puppetlabs.com/pubkey.gpg
<% repos += 1 -%>
# Puppetlabs dependencies
d-i apt-setup/local<%= repos %>/repository string \
http://apt.puppetlabs.com <%= @host.operatingsystem.release_name %> dependencies
d-i apt-setup/local<%= repos %>/comment string Puppetlabs dependencies
d-i apt-setup/local<%= repos %>/source boolean true
d-i apt-setup/local<%= repos %>/key string http://apt.puppetlabs.com/pubkey.gpg
<% repos += 1 -%>
<% end -%>

<% if salt_enabled -%>
<% salt_package = 'salt-minion' -%>
<% if @host.params['enable-saltstack-repo'] && @host.params['enable-saltstack-repo'] == 'true' -%>
<% if @host.operatingsystem.name == 'Debian' -%>
d-i apt-setup/local<%= repos %>/repository string http://debian.saltstack.com/debian <%= @host.operatingsystem.release_name %>-saltstack main
d-i apt-setup/local<%= repos %>/comment string SaltStack Repository
d-i apt-setup/local<%= repos %>/key string http://debian.saltstack.com/debian-salt-team-joehealy.gpg.key
<% repos += 1 -%>
<% end -%>
<% if @host.operatingsystem.name == 'Ubuntu' -%>
d-i apt-setup/local<%= repos %>/repository string http://ppa.launchpad.net/saltstack/salt/ubuntu <%= @host.operatingsystem.release_name %> main
d-i apt-setup/local<%= repos %>/comment string SaltStack Repository
d-i apt-setup/local<%= repos %>/key string http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x4759FA960E27C0A6
<% repos += 1 -%>
<% end -%>
<% end -%>
<% else -%>
<% salt_package = '' -%>
<% end -%>

# Install minimal task set (see tasksel --task-packages minimal)
tasksel tasksel/first multiselect minimal, ssh-server, openssh-server

<% if puppet_enabled %>
<% if @host.operatingsystem.name == 'Ubuntu' and @host.operatingsystem.major.to_i == 10 -%>
<% puppet_package = 'puppet/lucid-backports' -%>
d-i apt-setup/backports boolean true
<% else -%>
<% puppet_package = 'puppet' -%>
<% end -%>
<% else -%>
<% puppet_package = '' -%>
<% end -%>

# Install some base packages
d-i pkgsel/include string <%= puppet_package %> <%= salt_package %> lsb-release
d-i pkgsel/update-policy select unattended-upgrades

popularity-contest popularity-contest/participate boolean false

# Boot loader settings
#grub-pc grub-pc/hidden_timeout boolean false
#grub-pc grub-pc/timeout string 10
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
<% if @host.params['install-disk'] -%>
d-i grub-installer/bootdev string <%= @host.params['install-disk'] %>
<% elsif @host.operatingsystem.name == 'Debian' and @host.operatingsystem.major.to_i >= 8 -%>
d-i grub-installer/bootdev string default
<% end -%>
d-i finish-install/reboot_in_progress note

d-i preseed/late_command string wget -Y off <%= @static ? "'#{foreman_url('finish')}&static=true'" : foreman_url('finish') %> -O /target/tmp/finish.sh && in-target chmod +x /tmp/finish.sh && in-target /tmp/finish.sh
(6-6/7)