Revision 7b966530
Added by Dominic Cleal about 8 years ago
app/views/unattended/autoyast/PXELinux.erb | ||
---|---|---|
<%#
|
||
kind: PXELinux
|
||
name: AutoYaST default PXELinux
|
||
oses:
|
||
- SLES
|
||
- OpenSUSE
|
||
%>
|
||
DEFAULT linux
|
||
|
||
LABEL linux
|
||
KERNEL <%= @kernel %>
|
||
APPEND initrd=<%= @initrd %> ramdisk_size=65536 install=<%= @host.os.medium_uri(@host) %> autoyast=<%= foreman_url('provision') %> textmode=1
|
||
APPEND initrd=<%= @initrd %> ramdisk_size=65536 install=<%= @mediapath %> autoyast=<%= foreman_url('provision') %> textmode=1
|
app/views/unattended/autoyast/disklayout_lvm.erb | ||
---|---|---|
<%#
|
||
kind: ptable
|
||
name: AutoYaST LVM
|
||
oses:
|
||
- SLES
|
||
- OpenSUSE
|
||
%>
|
||
<partitioning config:type="list">
|
||
<drive>
|
app/views/unattended/autoyast/disklayout_scsi.erb | ||
---|---|---|
<%#
|
||
kind: ptable
|
||
name: AutoYaST entire SCSI disk
|
||
oses:
|
||
- SLES
|
||
- OpenSUSE
|
||
%>
|
||
<partitioning config:type="list">
|
||
<drive>
|
app/views/unattended/autoyast/disklayout_virtual.erb | ||
---|---|---|
<%#
|
||
kind: ptable
|
||
name: AutoYaST entire virtual disk
|
||
oses:
|
||
- SLES
|
||
- OpenSUSE
|
||
%>
|
||
<partitioning config:type="list">
|
||
<drive>
|
app/views/unattended/autoyast/iPXE.erb | ||
---|---|---|
kind: iPXE
|
||
name: AutoYaST default iPXE
|
||
oses:
|
||
- SLES 11
|
||
- SLES
|
||
- OpenSUSE
|
||
%>
|
||
|
||
kernel <%=@host.url_for_boot(:kernel) %> splash=silent install=<%=@host.os.medium_uri(@host)%> autoyast=<%= foreman_url('provision') %> text-mode=1 useDHCP=1
|
||
initrd <%=@host.url_for_boot(:initrd) %>
|
||
<% boot_files_uris = @host.operatingsystem.boot_files_uri(@host.medium,@host.architecture) -%>
|
||
<% kernel = boot_files_uris[0] -%>
|
||
<% initrd = boot_files_uris[1] -%>
|
||
|
||
kernel <%= kernel %> splash=silent install=<%=@host.os.medium_uri(@host)%> autoyast=<%= foreman_url('provision') %> text-mode=1 useDHCP=1
|
||
initrd <%= initrd %>
|
||
boot
|
app/views/unattended/autoyast/provision.erb | ||
---|---|---|
<%#
|
||
kind: provision
|
||
name: AutoYaST default
|
||
oses:
|
||
- OpenSUSE
|
||
%>
|
||
<%
|
||
os_major = @host.operatingsystem.major.to_i
|
||
... | ... | |
<notification>Setting up Puppet / Foreman ...</notification>
|
||
<source><![CDATA[
|
||
/bin/hostname <%= @host.name %>
|
||
|
||
<%= snippet('remote_execution_ssh_keys') %>
|
||
|
||
<% if puppet_enabled -%>
|
||
cat > /etc/puppet/puppet.conf << EOF
|
||
<%= snippet 'puppet.conf' -%>
|
||
EOF
|
||
if [ -f "/etc/sysconfig/puppet" ]
|
||
then
|
||
/usr/bin/sed -ie s/^PUPPET_SERVER=.*/PUPPET_SERVER=<%= @host.puppetmaster.blank? ? '' : @host.puppetmaster %>/ /etc/sysconfig/puppet
|
||
fi
|
||
/usr/bin/puppet agent --config /etc/puppet/puppet.conf -o --tags no_such_tag <%= @host.puppetmaster.blank? ? '' : "--server #{@host.puppetmaster}" %> --no-daemonize
|
||
/sbin/chkconfig puppet on -f
|
||
<%= snippet 'puppet_setup' %>
|
||
<% end -%>
|
||
|
||
<% if salt_enabled %>
|
||
cat > /etc/salt/minion << EOF
|
||
<%= snippet 'saltstack_minion' %>
|
||
EOF
|
||
# Setup salt-minion to run on system reboot
|
||
chkconfig salt-minion on
|
||
# Running salt-call to trigger key signing
|
||
salt-call --no-color --grains >/dev/null
|
||
<%= snippet 'saltstack_setup' %>
|
||
<% end -%>
|
||
|
||
<%= snippet('remote_execution_ssh_keys') %>
|
||
|
||
/usr/bin/curl -o /dev/null -k '<%= foreman_url %>'
|
||
/usr/bin/curl -o /dev/null -k '<%= foreman_url('built') %>'
|
||
|
||
rm /etc/resolv.conf
|
||
]]>
|
app/views/unattended/autoyast/provision_sles.erb | ||
---|---|---|
kind: provision
|
||
name: AutoYaST SLES default
|
||
oses:
|
||
- SLES 11
|
||
- SLES 12
|
||
- SLES
|
||
%>
|
||
<%
|
||
os_major = @host.operatingsystem.major.to_i
|
||
... | ... | |
<pattern>Minimal</pattern>
|
||
</patterns>
|
||
<packages config:type="list">
|
||
<package>less</package>
|
||
<package>lsb-release</package>
|
||
<package>openssh</package>
|
||
<package>vim</package>
|
||
<% if puppet_enabled -%>
|
||
<package>rubygem-puppet</package>
|
||
<% end -%>
|
||
... | ... | |
<notification>Setting up Puppet / Foreman ...</notification>
|
||
<source><![CDATA[
|
||
/bin/hostname <%= @host.name %>
|
||
|
||
<%= snippet('remote_execution_ssh_keys') %>
|
||
|
||
<% if puppet_enabled -%>
|
||
cat > /etc/puppet/puppet.conf << EOF
|
||
<%= snippet 'puppet.conf' -%>
|
||
EOF
|
||
if [ -f "/etc/sysconfig/puppet" ]
|
||
then
|
||
/usr/bin/sed -ie s/^PUPPET_SERVER=.*/PUPPET_SERVER=<%= @host.puppetmaster.blank? ? '' : @host.puppetmaster %>/ /etc/sysconfig/puppet
|
||
fi
|
||
/usr/bin/puppet agent --config /etc/puppet/puppet.conf -o --tags no_such_tag <%= @host.puppetmaster.blank? ? '' : "--server #{@host.puppetmaster}" %> --no-daemonize
|
||
/sbin/chkconfig puppet on -f
|
||
<%= snippet 'puppet_setup' %>
|
||
<% end -%>
|
||
|
||
<% if salt_enabled %>
|
||
cat > /etc/salt/minion << EOF
|
||
<%= snippet 'saltstack_minion' %>
|
||
EOF
|
||
# Setup salt-minion to run on system reboot
|
||
chkconfig salt-minion on
|
||
# Running salt-call to trigger key signing
|
||
salt-call --no-color --grains >/dev/null
|
||
<%= snippet 'saltstack_setup' %>
|
||
<% end -%>
|
||
|
||
<% if spacewalk_enabled -%>
|
||
<%= snippet 'redhat_register' %>
|
||
<% end -%>
|
||
|
||
/usr/bin/curl -o /dev/null -k '<%= foreman_url %>'
|
||
/usr/bin/curl -o /dev/null -k '<%= foreman_url('built') %>'
|
||
|
||
rm /etc/resolv.conf
|
||
]]>
|
app/views/unattended/cloudinit/userdata_cloudinit.erb | ||
---|---|---|
hostname: <%= @host.shortname %>
|
||
fqdn: <%= @host %>
|
||
manage_etc_hosts: true
|
||
ssh_pwauth: <%= @host.params['ssh_pwauth'] || true %>
|
||
<% if @host.params['ssh_authorized_keys'] -%>
|
||
ssh_authorized_keys:
|
||
<% @host.params['ssh_authorized_keys'].split("\n").each do |ssh_key| -%>
|
||
- <%= ssh_key %>
|
||
<% end -%>
|
||
<% end -%>
|
||
|
||
groups:
|
||
- admin
|
app/views/unattended/coreos/provision.erb | ||
---|---|---|
[Unit]
|
||
Description=Install coreos to disk
|
||
[Service]
|
||
ExecStart=/bin/bash -c "/usr/bin/coreos-install -C <%= @host.operatingsystem.release_name %> -d <%= @host.params['install-disk'] || '/dev/sda' %> -c /home/core/cloud-config.yml <% if @host.operatingsystem.major >= "557" -%>-b <%= @mediapath %><% end -%> && wget -q -O /dev/null --no-check-certificate <%= foreman_url %> && reboot"
|
||
ExecStart=/bin/bash -c "/usr/bin/coreos-install -C <%= @host.operatingsystem.release_name %> -d <%= @host.params['install-disk'] || '/dev/sda' %> -c /home/core/cloud-config.yml <% if @host.operatingsystem.major >= "557" -%>-b <%= @mediapath %><% end -%> && wget -q -O /dev/null --no-check-certificate <%= foreman_url('built') %> && reboot"
|
||
[X-Fleet]
|
||
X-Conflicts=coreos-bootstrap.service
|
||
<% if @host.params['ssh_authorized_keys'] -%>
|
app/views/unattended/freebsd/PXELinux_FreeBSD_mfsBSD.erb | ||
---|---|---|
kind: PXELinux
|
||
name: FreeBSD (mfsBSD) PXELinux
|
||
oses:
|
||
- FreeBSD 10.0
|
||
- FreeBSD
|
||
%>
|
||
# foreman_url=<%= foreman_url('provision') %>
|
||
DEFAULT freebsd
|
app/views/unattended/freebsd/disklayout_FreeBSD_mfsBSD.erb | ||
---|---|---|
kind: ptable
|
||
name: FreeBSD default fake
|
||
oses:
|
||
- FreeBSD 10.0
|
||
- FreeBSD
|
||
%>
|
||
# Not supported with zfsinstall
|
app/views/unattended/freebsd/finish_FreeBSD_mfsBSD.erb | ||
---|---|---|
kind: finish
|
||
name: FreeBSD (mfsBSD) finish
|
||
oses:
|
||
- FreeBSD 10.0
|
||
- FreeBSD
|
||
%>
|
||
<%
|
||
# safemode renderer does not support unary negation
|
||
... | ... | |
salt_enabled = @host.params['salt_master'] ? true : false
|
||
proxy_string = @host.params['http-proxy'] ? "http://#{@host.params['http-proxy']}:#{@host.params['http-proxy-port']}" : ''
|
||
%>
|
||
<% unless proxy_string == '' -%>
|
||
export http_proxy='<%= proxy_string %>'
|
||
<% end -%>
|
||
/bin/echo '<%= root_pass %>' | pw usermod root -H 0
|
||
cat >> /etc/rc.conf <<EOF
|
||
hostname="<%= @host %>"
|
||
... | ... | |
cp /usr/share/zoneinfo/<%= @host.params['time-zone'] || 'UTC' %> /etc/localtime
|
||
adjkerntz -a
|
||
ntpdate <%= @host.params['ntp-server'] || '0.freebsd.pool.ntp.org' %>
|
||
|
||
mkdir /root/install/
|
||
freebsd-update fetch > /root/install/freebsd-update_fetch.txt
|
||
freebsd-update install > /root/install/freebsd-update_install.txt
|
||
|
||
env ASSUME_ALWAYS_YES=YES pkg bootstrap
|
||
pkg update > /root/install/pkg_update.txt
|
||
pkg upgrade -y > /root/install/pkg_upgrade.txt
|
||
|
||
<% if puppet_enabled %>
|
||
pkg install -y puppet
|
||
echo 'puppet_enable="YES"' >>/etc/rc.conf
|
||
cat > /usr/local/etc/puppet/puppet.conf << EOF
|
||
<%= snippet 'puppet.conf' %>
|
||
EOF
|
||
|
||
/usr/local/bin/puppet agent --config /usr/local/etc/puppet/puppet.conf --onetime --tags no_such_tag <%= @host.puppetmaster.blank? ? '' : "--server #{@host.puppetmaster}" %> --no-daemonize
|
||
<%= snippet 'puppet_setup' %>
|
||
<% end -%>
|
||
|
||
<% if salt_enabled %>
|
||
pkg install -y py27-salt
|
||
cat > /usr/local/etc/salt/minion << EOF
|
||
<%= snippet 'saltstack_minion' %>
|
||
EOF
|
||
echo 'salt_minion_enable="YES"' >>/etc/rc.conf
|
||
echo 'salt_minion_paths="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"' >>/etc/rc.conf
|
||
# Running salt-call to trigger key signing
|
||
/usr/local/bin/salt-call --no-color --grains >/dev/null
|
||
<%= snippet 'saltstack_setup' %>
|
||
<% end -%>
|
||
<%= snippet('remote_execution_ssh_keys') %>
|
||
exit 0
|
app/views/unattended/freebsd/provision_FreeBSD_mfsBSD.erb | ||
---|---|---|
kind: provision
|
||
name: FreeBSD (mfsBSD) provision
|
||
oses:
|
||
- FreeBSD 10.0
|
||
- FreeBSD
|
||
%>
|
||
<%
|
||
proxy_string = @host.params['http-proxy'] ? "http://#{@host.params['http-proxy']}:#{@host.params['http-proxy-port']}" : ''
|
||
%>
|
||
<% unless proxy_string == '' -%>
|
||
export http_proxy='<%= proxy_string %>'
|
||
<% end -%>
|
||
|
||
# Get the disk layout, and the first disk connected to the system
|
||
disk_layout=`/sbin/sysctl -n kern.disks | /usr/bin/sed 's/cd[0-9]//g'`
|
||
first_disk="`echo ${disk_layout##*[1-9]} | /usr/bin/cut -d' ' -f1`"
|
||
... | ... | |
chroot /mnt /bin/sh /tmp/finish.sh
|
||
rm /mnt/tmp/finish.sh
|
||
|
||
fetch -q --no-verify-hostname --no-verify-peer -o /dev/null -d <%= foreman_url %>
|
||
fetch -q --no-verify-hostname --no-verify-peer -o /dev/null -d <%= foreman_url('built') %>
|
||
sleep 5
|
||
reboot
|
app/views/unattended/kickstart/PXELinux.erb | ||
---|---|---|
kind: PXELinux
|
||
name: Kickstart default PXELinux
|
||
oses:
|
||
- CentOS 4
|
||
- CentOS 5
|
||
- CentOS 6
|
||
- CentOS 7
|
||
- Fedora 16
|
||
- Fedora 17
|
||
- Fedora 18
|
||
- Fedora 19
|
||
- Fedora 20
|
||
- RedHat 4
|
||
- RedHat 5
|
||
- RedHat 6
|
||
- RedHat 7
|
||
- CentOS
|
||
- Fedora
|
||
- RedHat
|
||
%>
|
||
#
|
||
# This file was deployed via '<%= @template_name %>' template
|
app/views/unattended/kickstart/disklayout.erb | ||
---|---|---|
kind: ptable
|
||
name: Kickstart default
|
||
oses:
|
||
- CentOS 5
|
||
- CentOS 6
|
||
- CentOS 7
|
||
- Fedora 16
|
||
- Fedora 17
|
||
- Fedora 18
|
||
- Fedora 19
|
||
- Fedora 20
|
||
- RedHat 5
|
||
- RedHat 6
|
||
- RedHat 7
|
||
- CentOS
|
||
- Fedora
|
||
- RedHat
|
||
%>
|
||
zerombr
|
||
clearpart --all --initlabel
|
app/views/unattended/kickstart/finish.erb | ||
---|---|---|
kind: finish
|
||
name: Kickstart default finish
|
||
oses:
|
||
- CentOS 4
|
||
- CentOS 5
|
||
- CentOS 6
|
||
- CentOS 7
|
||
- Fedora 16
|
||
- Fedora 17
|
||
- Fedora 18
|
||
- Fedora 19
|
||
- Fedora 20
|
||
- CentOS
|
||
- Fedora
|
||
%>
|
||
<% if @host.subnet.respond_to?(:dhcp_boot_mode?) -%>
|
||
<%= snippet 'kickstart_networking_setup' %>
|
||
... | ... | |
os_major = @host.operatingsystem.major.to_i
|
||
pm_set = @host.puppetmaster.empty? ? false : true
|
||
puppet_enabled = pm_set || @host.param_true?('force-puppet')
|
||
salt_enabled = @host.params['salt_master'] ? true : false
|
||
chef_enabled = @host.respond_to?(:chef_proxy) && @host.chef_proxy
|
||
%>
|
||
|
||
<% if @host.provision_method == 'image' && !root_pass.empty? -%>
|
||
... | ... | |
rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-<%= os_major -%>.noarch.rpm
|
||
<% end -%>
|
||
<% end -%>
|
||
yum -t -y -e 0 install puppet
|
||
<% if @host.param_true?('enable-puppetlabs-pc1-repo') -%>
|
||
<% if @host.operatingsystem.name == 'Fedora' -%>
|
||
rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-pc1-fedora-<%= os_major -%>.noarch.rpm
|
||
<% else -%>
|
||
rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-pc1-el-<%= os_major -%>.noarch.rpm
|
||
<% end -%>
|
||
<% end -%>
|
||
<% end -%>
|
||
|
||
#update local time
|
||
... | ... | |
<% end -%>
|
||
|
||
# update all the base packages from the updates repository
|
||
yum -t -y -e 0 update
|
||
yum -t -y update
|
||
|
||
<% if puppet_enabled %>
|
||
echo "Configuring puppet"
|
||
cat > /etc/puppet/puppet.conf << EOF
|
||
<%= snippet 'puppet.conf' %>
|
||
EOF
|
||
<%= snippet('remote_execution_ssh_keys') %>
|
||
|
||
# Setup puppet to run on system reboot
|
||
<% if @host.operatingsystem.name == 'Fedora' -%>
|
||
puppet_unit=puppet
|
||
/usr/bin/systemctl list-unit-files | grep -q puppetagent && puppet_unit=puppetagent
|
||
/usr/bin/systemctl enable ${puppet_unit}
|
||
<% else -%>
|
||
/sbin/chkconfig --level 345 puppet on
|
||
<% if chef_enabled %>
|
||
<%= snippet 'chef_client' %>
|
||
<% end -%>
|
||
|
||
/usr/bin/puppet agent --config /etc/puppet/puppet.conf -o --tags no_such_tag <%= @host.puppetmaster.blank? ? '' : "--server #{@host.puppetmaster}" %> --no-daemonize
|
||
<% if puppet_enabled %>
|
||
<%= snippet 'puppet_setup' %>
|
||
<% end -%>
|
||
|
||
<% if salt_enabled %>
|
||
<%= snippet 'saltstack_setup' %>
|
||
<% end -%>
|
||
|
||
sync
|
||
|
||
exit 0
|
app/views/unattended/kickstart/iPXE.erb | ||
---|---|---|
kind: iPXE
|
||
name: Kickstart default iPXE
|
||
oses:
|
||
- CentOS 5
|
||
- CentOS 6
|
||
- CentOS 7
|
||
- Fedora 16
|
||
- Fedora 17
|
||
- Fedora 18
|
||
- Fedora 19
|
||
- Fedora 20
|
||
- RedHat 5
|
||
- RedHat 6
|
||
- RedHat 7
|
||
- CentOS
|
||
- Fedora
|
||
- RedHat
|
||
%>
|
||
<% subnet = @host.subnet -%>
|
||
<% if subnet.respond_to?(:dhcp_boot_mode?) && subnet.dhcp_boot_mode? -%>
|
||
... | ... | |
<% static = (@host.token.nil? ? '?' : '&') + static_arg -%>
|
||
<% end -%>
|
||
|
||
<%# This template will not function with Safemode set to true.
|
||
Please disable it in Settings > Provisioning %>
|
||
|
||
kernel <%= "#{@host.url_for_boot(:kernel)}" %> ks=<%= foreman_url('provision')%><%= static %> ksdevice=<%= @host.mac %> network kssendmac ip=${netX/ip} netmask=${netX/netmask} gateway=${netX/gateway} dns=${dns}
|
||
initrd <%= "#{@host.url_for_boot(:initrd)}" %>
|
||
|
app/views/unattended/kickstart/provision.erb | ||
---|---|---|
kind: provision
|
||
name: Kickstart default
|
||
oses:
|
||
- CentOS 4
|
||
- CentOS 5
|
||
- CentOS 6
|
||
- CentOS 7
|
||
- Fedora 16
|
||
- Fedora 17
|
||
- Fedora 18
|
||
- Fedora 19
|
||
- Fedora 20
|
||
- CentOS
|
||
- Fedora
|
||
%>
|
||
<%#
|
||
This template accepts the following parameters:
|
||
... | ... | |
- http-proxy-port: string (default="")
|
||
- force-puppet: boolean (default=false)
|
||
- enable-puppetlabs-repo: boolean (default=false)
|
||
- enable-puppetlabs-pc1-repo: boolean (default=false)
|
||
- salt_master: string (default=undef)
|
||
- ntp-server: string (default="0.fedora.pool.ntp.org")
|
||
- bootloader-append: string (default="nofb quiet splash=quiet")
|
||
- disable-firewall: boolean (default=false)
|
||
%>
|
||
<%
|
||
rhel_compatible = @host.operatingsystem.family == 'Redhat' && @host.operatingsystem.name != 'Fedora'
|
||
... | ... | |
<% else -%>
|
||
<% dhcp = !@static -%>
|
||
<% end -%>
|
||
|
||
network --bootproto <%= dhcp ? 'dhcp' : "static --ip=#{@host.ip} --netmask=#{subnet.mask} --gateway=#{subnet.gateway} --nameserver=#{[subnet.dns_primary, subnet.dns_secondary].select(&:present?).join(',')}" %> --hostname <%= @host %><%= os_major >= 6 ? " --device=#{@host.mac}" : '' -%>
|
||
|
||
rootpw --iscrypted <%= root_pass %>
|
||
<% if @host.param_true?('disable-firewall') -%>
|
||
firewall --disable
|
||
<% else -%>
|
||
firewall --<%= os_major >= 6 ? 'service=' : '' %>ssh
|
||
<% end -%>
|
||
authconfig --useshadow --passalgo=sha256 --kickstart
|
||
timezone --utc <%= @host.params['time-zone'] || 'UTC' %>
|
||
<% if rhel_compatible && os_major > 4 -%>
|
||
... | ... | |
|
||
<% if @host.operatingsystem.name == 'Fedora' -%>
|
||
repo --name=fedora-everything --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-<%= @host.operatingsystem.major %>&arch=<%= @host.architecture %><%= proxy_string %>
|
||
<% if puppet_enabled && @host.param_true?('enable-puppetlabs-repo') -%>
|
||
<% if puppet_enabled -%>
|
||
<% if @host.param_true?('enable-puppetlabs-repo') -%>
|
||
repo --name=puppetlabs-products --baseurl=http://yum.puppetlabs.com/fedora/f<%= @host.operatingsystem.major %>/products/<%= @host.architecture %><%= proxy_string %>
|
||
repo --name=puppetlabs-deps --baseurl=http://yum.puppetlabs.com/fedora/f<%= @host.operatingsystem.major %>/dependencies/<%= @host.architecture %><%= proxy_string %>
|
||
<% end -%>
|
||
<% if @host.param_true?('enable-puppetlabs-pc1-repo') -%>
|
||
repo --name=puppetlabs-pc1 --baseurl=http://yum.puppetlabs.com/fedora/f<%= @host.operatingsystem.major %>/PC1/<%= @host.architecture %><%= proxy_string %>
|
||
<% end -%>
|
||
<% end -%>
|
||
<% elsif rhel_compatible && os_major > 4 -%>
|
||
repo --name="EPEL" --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-<%= @host.operatingsystem.major %>&arch=<%= @host.architecture %><%= proxy_string %>
|
||
<% if puppet_enabled && @host.param_true?('enable-puppetlabs-repo') -%>
|
||
<% if puppet_enabled -%>
|
||
<% if @host.param_true?('enable-puppetlabs-repo') -%>
|
||
repo --name=puppetlabs-products --baseurl=http://yum.puppetlabs.com/el/<%= @host.operatingsystem.major %>/products/<%= @host.architecture %><%= proxy_string %>
|
||
repo --name=puppetlabs-deps --baseurl=http://yum.puppetlabs.com/el/<%= @host.operatingsystem.major %>/dependencies/<%= @host.architecture %><%= proxy_string %>
|
||
<% end -%>
|
||
<% if @host.param_true?('enable-puppetlabs-pc1-repo') -%>
|
||
repo --name=puppetlabs-pc1 --baseurl=http://yum.puppetlabs.com/el/<%= @host.operatingsystem.major %>/PC1/<%= @host.architecture %><%= proxy_string %>
|
||
<% end -%>
|
||
<% end -%>
|
||
<% end -%>
|
||
|
||
<% if @host.operatingsystem.name == 'Fedora' and os_major <= 16 -%>
|
||
... | ... | |
part biosboot --fstype=biosboot --size=1
|
||
<% else -%>
|
||
bootloader --location=mbr --append="<%= @host.params['bootloader-append'] || 'nofb quiet splash=quiet' %>" <%= grub_pass %>
|
||
<% if os_major == 5 -%>
|
||
key --skip
|
||
<% end -%>
|
||
<% end -%>
|
||
|
||
<% if @dynamic -%>
|
||
... | ... | |
<% end -%>
|
||
|
||
text
|
||
<% if @host.respond_to?(:bootdisk_build?) && @host.bootdisk_build? %>
|
||
reboot --eject
|
||
<% else -%>
|
||
reboot
|
||
<% end -%>
|
||
|
||
%packages
|
||
yum
|
||
... | ... | |
<% if rhel_compatible && os_major > 4 -%>
|
||
epel-release
|
||
<% end -%>
|
||
<% if puppet_enabled %>
|
||
puppet
|
||
<% if puppet_enabled -%>
|
||
<%= @host.param_true?('enable-puppetlabs-pc1-repo') ? 'puppet-agent' : 'puppet' %>
|
||
<% if @host.param_true?('enable-puppetlabs-repo') -%>
|
||
puppetlabs-release
|
||
<% end -%>
|
||
<% if @host.param_true?('enable-puppetlabs-pc1-repo') -%>
|
||
puppetlabs-release-pc1
|
||
<% end -%>
|
||
<% end -%>
|
||
<% if salt_enabled %>
|
||
salt-minion
|
||
... | ... | |
<% end -%>
|
||
|
||
# update all the base packages from the updates repository
|
||
yum -t -y -e 0 update
|
||
|
||
<% if chef_enabled %>
|
||
echo "Bootstraping chef"
|
||
<%= respond_to?(:chef_bootstrap) ? chef_bootstrap(@host) : snippet_if_exists("chef-client omnibus bootstrap") %>
|
||
<% end%>
|
||
|
||
<% if puppet_enabled %>
|
||
echo "Configuring puppet"
|
||
cat > /etc/puppet/puppet.conf << EOF
|
||
<%= snippet 'puppet.conf' %>
|
||
EOF
|
||
yum -t -y update
|
||
|
||
<%= snippet('remote_execution_ssh_keys') %>
|
||
|
||
# Setup puppet to run on system reboot
|
||
/sbin/chkconfig --level 345 puppet on
|
||
<% if chef_enabled %>
|
||
<%= snippet 'chef_client' %>
|
||
<% end -%>
|
||
|
||
/usr/bin/puppet agent --config /etc/puppet/puppet.conf -o --tags no_such_tag <%= @host.puppetmaster.blank? ? '' : "--server #{@host.puppetmaster}" %> --no-daemonize
|
||
<% if puppet_enabled %>
|
||
<%= snippet 'puppet_setup' %>
|
||
<% end -%>
|
||
|
||
<% if salt_enabled %>
|
||
cat > /etc/salt/minion << EOF
|
||
<%= snippet 'saltstack_minion' %>
|
||
EOF
|
||
# Setup salt-minion to run on system reboot
|
||
/sbin/chkconfig --level 345 salt-minion on
|
||
# Running salt-call to trigger key signing
|
||
salt-call --no-color --grains >/dev/null
|
||
<%= snippet 'saltstack_setup' %>
|
||
<% end -%>
|
||
|
||
sync
|
||
|
||
# Inform the build system that we are done.
|
||
echo "Informing Foreman that we are built"
|
||
wget -q -O /dev/null --no-check-certificate <%= foreman_url %>
|
||
wget -q -O /dev/null --no-check-certificate <%= foreman_url('built') %>
|
||
) 2>&1 | tee /root/install.post.log
|
||
exit 0
|
||
|
app/views/unattended/kickstart/provision_atomic.erb | ||
---|---|---|
text
|
||
|
||
<% if @host.os.name.match /.*fedora.*/i -%>
|
||
ostreesetup --nogpg --osname=fedora-atomic --remote=fedora-atomic --url=<%= @host.param_true?('atomic-upstream') ? "https://dl.fedoraproject.org/pub/fedora/linux/atomic/#{@host.os.major}/" : "#{@host.operatingsystem.medium_uri(@host)}/content/repo/" %> --ref=fedora-atomic/f<%= @host.os.major %>/<%= @host.architecture %>/docker-host
|
||
# Use @host.operatingsystem.medium_uri(@host)}/content/repo/ as the URL if you
|
||
# have set up a local installation media for Fedora
|
||
<% fedora_atomic_url = @host.params['atomic_refs_url'] || "https://dl.fedoraproject.org/pub/fedora/linux/atomic/#{@host.os.major}/" %>
|
||
ostreesetup --nogpg --osname=fedora-atomic --remote=fedora-atomic --url=<%= fedora_atomic_url %> --ref=fedora-atomic/f<%= @host.os.major %>/<%= @host.architecture %>/docker-host
|
||
<% elsif @host.os.name.match /.*centos.*/i -%>
|
||
ostreesetup --nogpg --osname=centos-atomic-host --remote=centos-atomic-host --url=<%= @host.param_true?('atomic-upstream') ? "http://mirror.centos.org/centos/#{@host.os.major}/atomic/#{@host.architecture}/repo/" : @host.operatingsystem.medium_uri(@host) %> --ref=centos-atomic-host/<%= @host.os.major %>/<%= @host.architecture %>/standard
|
||
<% else -%>
|
||
... | ... | |
%post
|
||
(
|
||
# Report success back to Foreman
|
||
curl -s -o /dev/null --insecure <%= foreman_url %>
|
||
curl -s -o /dev/null --insecure <%= foreman_url('built') %>
|
||
) 2>&1 | tee /mnt/sysimage/root/install.post.log
|
||
|
||
exit 0
|
app/views/unattended/kickstart/provision_rhel.erb | ||
---|---|---|
kind: provision
|
||
name: Kickstart RHEL default
|
||
oses:
|
||
- RedHat 4
|
||
- RedHat 5
|
||
- RedHat 6
|
||
- RedHat 7
|
||
- RedHat
|
||
%>
|
||
<%#
|
||
This template accepts the following parameters:
|
||
... | ... | |
- http-proxy-port: string (default="")
|
||
- force-puppet: boolean (default=false)
|
||
- enable-puppetlabs-repo: boolean (default=false)
|
||
- enable-puppetlabs-pc1-repo: boolean (default=false)
|
||
- salt_master: string (default=undef)
|
||
- ntp-server: string (default="0.fedora.pool.ntp.org")
|
||
- bootloader-append: string (default="nofb quiet splash=quiet")
|
||
- disable-firewall: boolean (default=false)
|
||
%>
|
||
<%
|
||
os_major = @host.operatingsystem.major.to_i
|
||
realm_compatible = os_major >= 7 ? true : false
|
||
# safemode renderer does not support unary negation
|
||
pm_set = @host.puppetmaster.empty? ? false : true
|
||
proxy_uri = @host.params['http-proxy'] ? "http://#{@host.params['http-proxy']}:#{@host.params['http-proxy-port']}" : nil
|
||
proxy_string = proxy_uri ? " --proxy=#{proxy_uri}" : ''
|
||
puppet_enabled = pm_set || @host.param_true?('force-puppet')
|
||
salt_enabled = @host.params['salt_master'] ? true : false
|
||
chef_enabled = @host.respond_to?(:chef_proxy) && @host.chef_proxy
|
||
section_end = os_major <= 5 ? '' : '%end'
|
||
%>
|
||
install
|
||
... | ... | |
|
||
<% subnet = @host.subnet -%>
|
||
<% if subnet.respond_to?(:dhcp_boot_mode?) -%>
|
||
<% dhcp = subnet.dhcp_boot_mode? && !@static -%>
|
||
<% dhcp = subnet.dhcp_boot_mode? && !@static -%>
|
||
<% else -%>
|
||
<% dhcp = !@static -%>
|
||
<% dhcp = !@static -%>
|
||
<% end -%>
|
||
network --bootproto <%= dhcp ? 'dhcp' : "static --ip=#{@host.ip} --netmask=#{subnet.mask} --gateway=#{subnet.gateway} --nameserver=#{[subnet.dns_primary, subnet.dns_secondary].select(&:present?).join(',')}" %> --hostname <%= @host %><%= os_major >= 6 ? " --device=#{@host.mac}" : '' -%>
|
||
|
||
rootpw --iscrypted <%= root_pass %>
|
||
<% if @host.param_true?('disable-firewall') -%>
|
||
firewall --disable
|
||
<% else -%>
|
||
firewall --<%= os_major >= 6 ? 'service=' : '' %>ssh
|
||
<% end -%>
|
||
authconfig --useshadow --passalgo=sha256 --kickstart
|
||
timezone --utc <%= @host.params['time-zone'] || 'UTC' %>
|
||
<% if os_major > 4 -%>
|
||
services --disabled gpm,sendmail,cups,pcmcia,isdn,rawdevices,hpoj,bluetooth,openibd,avahi-daemon,avahi-dnsconfd,hidd,hplip,pcscd
|
||
<% end -%>
|
||
|
||
<% if os_major >= 7 && @host.info['parameters']['realm'] && @host.realm && @host.realm.realm_type == 'Active Directory' -%>
|
||
<% if realm_compatible && @host.info['parameters']['realm'] && @host.realm && @host.realm.realm_type == 'Active Directory' -%>
|
||
# One-time password will be requested at install time. Otherwise, $HOST[OTP] is used as a placeholder value.
|
||
realm join --one-time-password=<%= @host.otp || "$HOST[OTP]" %> <%= @host.realm %>
|
||
realm join --one-time-password='<%= @host.otp || "$HOST[OTP]" %>' <%= @host.realm %>
|
||
<% end -%>
|
||
|
||
<% if os_major > 4 -%>
|
||
services --disabled gpm,sendmail,cups,pcmcia,isdn,rawdevices,hpoj,bluetooth,openibd,avahi-daemon,avahi-dnsconfd,hidd,hplip,pcscd
|
||
|
||
repo --name="EPEL" --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-<%= @host.operatingsystem.major %>&arch=<%= @host.architecture %><%= proxy_string %>
|
||
<% if puppet_enabled && @host.param_true?('enable-puppetlabs-repo') -%>
|
||
<% if puppet_enabled -%>
|
||
<% if @host.param_true?('enable-puppetlabs-repo') -%>
|
||
repo --name=puppetlabs-products --baseurl=http://yum.puppetlabs.com/el/<%= @host.operatingsystem.major %>/products/<%= @host.architecture %><%= proxy_string %>
|
||
repo --name=puppetlabs-deps --baseurl=http://yum.puppetlabs.com/el/<%= @host.operatingsystem.major %>/dependencies/<%= @host.architecture %><%= proxy_string %>
|
||
<% end -%>
|
||
<% if @host.param_true?('enable-puppetlabs-pc1-repo') -%>
|
||
repo --name=puppetlabs-pc1 --baseurl=http://yum.puppetlabs.com/el/<%= @host.operatingsystem.major %>/PC1/<%= @host.architecture %><%= proxy_string %>
|
||
<% end -%>
|
||
<% end -%>
|
||
<% end -%>
|
||
|
||
bootloader --location=mbr --append="<%= @host.params['bootloader-append'] || 'nofb quiet splash=quiet' %>" <%= grub_pass %>
|
||
... | ... | |
key --skip
|
||
<% end -%>
|
||
|
||
|
||
<% if @dynamic -%>
|
||
%include /tmp/diskpart.cfg
|
||
<% else -%>
|
||
... | ... | |
<% if os_major >= 6 -%>
|
||
redhat-lsb-core
|
||
<% end -%>
|
||
<% if os_major > 4 -%>
|
||
epel-release
|
||
<% if puppet_enabled && @host.param_true?('enable-puppetlabs-repo') -%>
|
||
<% end -%>
|
||
<% if puppet_enabled -%>
|
||
<% if @host.param_true?('enable-puppetlabs-repo') -%>
|
||
puppetlabs-release
|
||
<% end -%>
|
||
<% if @host.param_true?('enable-puppetlabs-pc1-repo') -%>
|
||
puppetlabs-release-pc1
|
||
<% end -%>
|
||
<% end -%>
|
||
<% if salt_enabled %>
|
||
salt-minion
|
||
<% end -%>
|
||
... | ... | |
<% end -%>
|
||
|
||
# update all the base packages from the updates repository
|
||
yum -t -y -e 0 update
|
||
yum -t -y update
|
||
|
||
<% if puppet_enabled %>
|
||
# and add the puppet package
|
||
yum -t -y -e 0 install puppet
|
||
|
||
echo "Configuring puppet"
|
||
cat > /etc/puppet/puppet.conf << EOF
|
||
<%= snippet 'puppet.conf' %>
|
||
EOF
|
||
<%= snippet('remote_execution_ssh_keys') %>
|
||
|
||
# Setup puppet to run on system reboot
|
||
/sbin/chkconfig --level 345 puppet on
|
||
<% if chef_enabled %>
|
||
<%= snippet 'chef_client' %>
|
||
<% end -%>
|
||
|
||
/usr/bin/puppet agent --config /etc/puppet/puppet.conf -o --tags no_such_tag <%= @host.puppetmaster.blank? ? '' : "--server #{@host.puppetmaster}" %> --no-daemonize
|
||
<% if puppet_enabled %>
|
||
<%= snippet 'puppet_setup' %>
|
||
<% end -%>
|
||
|
||
<% if salt_enabled %>
|
||
cat > /etc/salt/minion << EOF
|
||
<%= snippet 'saltstack_minion' %>
|
||
EOF
|
||
# Setup salt-minion to run on system reboot
|
||
/sbin/chkconfig --level 345 salt-minion on
|
||
# Running salt-call to trigger key signing
|
||
salt-call --no-color --grains >/dev/null
|
||
<%= snippet 'saltstack_setup' %>
|
||
<% end -%>
|
||
|
||
sync
|
||
|
||
# Inform the build system that we are done.
|
||
echo "Informing Foreman that we are built"
|
||
wget -q -O /dev/null --no-check-certificate <%= foreman_url %>
|
||
wget -q -O /dev/null --no-check-certificate <%= foreman_url('built') %>
|
||
) 2>&1 | tee /root/install.post.log
|
||
exit 0
|
||
|
app/views/unattended/kickstart/userdata.erb | ||
---|---|---|
kind: user_data
|
||
name: Kickstart default user data
|
||
oses:
|
||
- CentOS 4
|
||
- CentOS 5
|
||
- CentOS 6
|
||
- CentOS 7
|
||
- Fedora 16
|
||
- Fedora 17
|
||
- Fedora 18
|
||
- Fedora 19
|
||
- Fedora 20
|
||
- CentOS
|
||
- Fedora
|
||
-%>
|
||
#!/bin/bash
|
||
|
||
<%# Cloud instances frequently have incorrect hosts data %>
|
||
<%= snippet 'fix_hosts' %>
|
||
|
||
<%
|
||
# safemode renderer does not support unary negation
|
||
pm_set = @host.puppetmaster.empty? ? false : true
|
||
puppet_enabled = pm_set || @host.param_true?('force-puppet')
|
||
salt_enabled = @host.params['salt_master'] ? true : false
|
||
chef_enabled = @host.respond_to?(:chef_proxy) && @host.chef_proxy
|
||
%>
|
||
<% if puppet_enabled %>
|
||
yum install -y puppet
|
||
cat > /etc/puppet/puppet.conf << EOF
|
||
<%= snippet 'puppet.conf' %>
|
||
EOF
|
||
#!/bin/bash
|
||
|
||
# Setup puppet to run on system reboot
|
||
/sbin/chkconfig --level 345 puppet on
|
||
<%# Cloud instances frequently have incorrect hosts data %>
|
||
<%= snippet 'fix_hosts' %>
|
||
|
||
/usr/bin/puppet agent --config /etc/puppet/puppet.conf --onetime --tags no_such_tag <%= @host.puppetmaster.blank? ? '' : "--server #{@host.puppetmaster}" %> --no-daemonize
|
||
<%= snippet('remote_execution_ssh_keys') %>
|
||
|
||
<% if chef_enabled %>
|
||
<%= snippet 'chef_client' %>
|
||
<% end -%>
|
||
|
||
<% if puppet_enabled %>
|
||
<%= snippet 'puppet_setup' %>
|
||
<% end -%>
|
||
|
||
<% if salt_enabled %>
|
||
<%= snippet 'saltstack_setup' %>
|
||
<% end -%>
|
||
# UserData still needs wget to mark as finished
|
||
/usr/bin/wget --quiet --output-document=/dev/null --no-check-certificate <%= foreman_url('built') %>
|
app/views/unattended/preseed/finish.erb | ||
---|---|---|
|
||
<% subnet = @host.subnet -%>
|
||
<% if subnet.respond_to?(:dhcp_boot_mode?) -%>
|
||
<% dhcp = subnet.dhcp_boot_mode? && !@static -%>
|
||
<% dhcp = subnet.dhcp_boot_mode? && !@static -%>
|
||
<% else -%>
|
||
<% dhcp = !@static -%>
|
||
<% dhcp = !@static -%>
|
||
<% end -%>
|
||
<% unless dhcp -%>
|
||
# host and domain name need setting as these values may have come from dhcp if pxe booting
|
||
... | ... | |
/bin/sed -i "s/^<%= @host.ip %>.*/<%= @host.ip %>\t<%= @host.shortname %>.<%= @host.domain %>\t<%= @host.shortname %>/g" /etc/hosts
|
||
/bin/echo <%= @host.shortname %> > /etc/hostname
|
||
<% end -%>
|
||
<% if puppet_enabled %>
|
||
cat > /etc/puppet/puppet.conf << EOF
|
||
<%= snippet 'puppet.conf' %>
|
||
EOF
|
||
if [ -f "/etc/default/puppet" ]
|
||
then
|
||
/bin/sed -i 's/^START=no/START=yes/' /etc/default/puppet
|
||
fi
|
||
/bin/touch /etc/puppet/namespaceauth.conf
|
||
/usr/bin/puppet agent --enable
|
||
/usr/bin/puppet agent --config /etc/puppet/puppet.conf --onetime --tags no_such_tag <%= @host.puppetmaster.blank? ? '' : "--server #{@host.puppetmaster}" %> --no-daemonize
|
||
<% end -%>
|
||
|
||
<% if @host.info['parameters']['realm'] && @host.realm && @host.realm.realm_type == 'FreeIPA' -%>
|
||
<%= snippet 'freeipa_register' %>
|
||
<% end -%>
|
||
|
||
<%= snippet('remote_execution_ssh_keys') %>
|
||
|
||
<% if chef_enabled %>
|
||
<%= snippet 'chef_client' %>
|
||
<% end -%>
|
||
|
||
<% if puppet_enabled %>
|
||
<%= snippet 'puppet_setup' %>
|
||
<% end -%>
|
||
|
||
<% if salt_enabled %>
|
||
cat > /etc/salt/minion << EOF
|
||
<%= snippet 'saltstack_minion' %>
|
||
EOF
|
||
# Running salt-call to trigger key signing
|
||
salt-call --no-color --grains >/dev/null
|
||
<%= snippet 'saltstack_setup' %>
|
||
<% end -%>
|
||
|
||
<% if chef_enabled %>
|
||
<%= respond_to?(:chef_bootstrap) ? chef_bootstrap(@host) : snippet_if_exists("chef-client omnibus bootstrap") %>
|
||
<% end%>
|
||
<%= snippet('remote_execution_ssh_keys') %>
|
||
/usr/bin/wget --no-proxy --quiet --output-document=/dev/null --no-check-certificate <%= foreman_url %>
|
||
<%= snippet 'preseed_networking_setup' %>
|
||
/usr/bin/wget --no-proxy --quiet --output-document=/dev/null --no-check-certificate <%= foreman_url('built') %>
|
app/views/unattended/preseed/iPXE.erb | ||
---|---|---|
<% else -%>
|
||
<% keyboard_params = 'console-setup/ask_detect=false console-setup/layout=USA console-setup/variant=USA keyboard-configuration/layoutcode=us' -%>
|
||
<% end -%>
|
||
<% kernel, initrd = @host.operatingsystem.boot_files_uri(@host.medium,@host.architecture) -%>
|
||
<% boot_files_uris = @host.operatingsystem.boot_files_uri(@host.medium,@host.architecture) -%>
|
||
<% kernel = boot_files_uris[0] -%>
|
||
<% initrd = boot_files_uris[1] -%>
|
||
<% static = @host.token.nil? ? '?static=yes' : '&static=yes' -%>
|
||
|
||
<%# This template will not function with Safemode set to true.
|
||
Please disable it in Settings > Provisioning %>
|
||
|
||
kernel <%= kernel %> interface=auto url=<%= foreman_url('provision')%><%= static %> ramdisk_size=10800 root=/dev/rd/0 rw auto netcfg/disable_dhcp=true BOOTIF=${netX/mac} hostname=<%= @host.name %> <%= keyboard_params %> locale=<%= @host.params['lang'] || 'en_US' %> netcfg/get_ipaddress=${netX/ip} netcfg/get_netmask=${netX/netmask} netcfg/get_gateway=${netX/gateway} netcfg/get_nameservers=${dns} netcfg/confirm_static=true
|
||
initrd <%= initrd %>
|
||
|
app/views/unattended/preseed/provision.erb | ||
---|---|---|
user-setup-udeb passwd/make-user boolean false
|
||
|
||
<% repos = 0 %>
|
||
<% if puppet_enabled && @host.param_true?('enable-puppetlabs-repo') -%>
|
||
<% if puppet_enabled -%>
|
||
<% if @host.param_true?('enable-puppetlabs-repo') -%>
|
||
# 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 %>/key string http://apt.puppetlabs.com/pubkey.gpg
|
||
<% repos += 1 -%>
|
||
<% end -%>
|
||
<% if @host.param_true?('enable-puppetlabs-pc1-repo') -%>
|
||
# Puppetlabs PC1 <%= @host.operatingsystem.release_name %> Repository
|
||
d-i apt-setup/local<%= repos %>/repository string http://apt.puppetlabs.com <%= @host.operatingsystem.release_name %> PC1
|
||
d-i apt-setup/local<%= repos %>/comment string Puppetlabs PC1 <%= @host.operatingsystem.release_name %> Repository
|
||
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 -%>
|
||
<% end -%>
|
||
|
||
<% if salt_enabled -%>
|
||
<% salt_package = 'salt-minion' -%>
|
||
... | ... | |
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 -%>
|
||
<% puppet_package = @host.param_true?('enable-puppetlabs-pc1-repo') ? 'puppet-agent' : 'puppet' -%>
|
||
<% else -%>
|
||
<% puppet_package = '' -%>
|
||
<% puppet_package = '' -%>
|
||
<% end -%>
|
||
|
||
# Install some base packages
|
app/views/unattended/preseed/userdata.erb | ||
---|---|---|
# safemode renderer does not support unary negation
|
||
pm_set = @host.puppetmaster.empty? ? false : true
|
||
puppet_enabled = pm_set || @host.param_true?('force-puppet')
|
||
salt_enabled = @host.params['salt_master'] ? true : false
|
||
chef_enabled = @host.respond_to?(:chef_proxy) && @host.chef_proxy
|
||
%>
|
||
|
||
<% if @host.info['parameters']['realm'] && @host.realm && @host.realm.realm_type == 'FreeIPA' -%>
|
||
<%= snippet 'freeipa_register' %>
|
||
<% end -%>
|
||
|
||
<%= snippet('remote_execution_ssh_keys') %>
|
||
|
||
<% if chef_enabled %>
|
||
<%= snippet 'chef_client' %>
|
||
<% end -%>
|
||
|
||
<% if puppet_enabled %>
|
||
apt-get update
|
||
apt-get install -y puppet
|
||
cat > /etc/puppet/puppet.conf << EOF
|
||
<%= snippet 'puppet.conf' %>
|
||
EOF
|
||
if [ -f "/etc/default/puppet" ]
|
||
then
|
||
/bin/sed -i 's/^START=no/START=yes/' /etc/default/puppet
|
||
fi
|
||
/bin/touch /etc/puppet/namespaceauth.conf
|
||
/usr/bin/puppet agent --enable
|
||
/usr/bin/puppet agent --config /etc/puppet/puppet.conf --onetime --tags no_such_tag <%= @host.puppetmaster.blank? ? '' : "--server #{@host.puppetmaster}" %> --no-daemonize
|
||
<%= snippet 'puppet_setup' %>
|
||
<% end -%>
|
||
|
||
<% if salt_enabled %>
|
||
<%= snippet 'saltstack_setup' %>
|
||
<% end -%>
|
||
|
||
# UserData still needs wget to mark as finished
|
app/views/unattended/pxe/PXELinux_default.erb | ||
---|---|---|
MENU DEFAULT
|
||
LOCALBOOT 0
|
||
|
||
LABEL discovery
|
||
MENU LABEL (discovery)
|
||
KERNEL boot/fdi-image/vmlinuz0
|
||
APPEND initrd=boot/fdi-image/initrd0.img rootflags=loop root=live:/fdi.iso rootfstype=auto ro rd.live.image acpi=force rd.luks=0 rd.md=0 rd.dm=0 rd.lvm=0 rd.bootif=0 rd.neednet=0 nomodeset proxy.url=https://FOREMAN_INSTANCE proxy.type=foreman
|
||
IPAPPEND 2
|
||
<%= snippet "pxelinux_discovery" %>
|
||
|
||
<% for profile in @profiles -%>
|
||
LABEL <%= "#{profile[:template]} - #{profile[:hostgroup]}" %>
|
app/views/unattended/snippets/_chef_client.erb | ||
---|---|---|
<%#
|
||
kind: snippet
|
||
name: chef_client
|
||
description: this is a single entry point for chef-client bootstrapping, it selects
|
||
a bootstrapping strategy based on host parameter named "chef_bootstrap_template"
|
||
note that it can be set per hostgroup, os, domain etc.
|
||
if there's no strategy set, omnibus is used by default
|
||
%>
|
||
echo "Bootstraping chef"
|
||
<%= snippet_if_exists(@host.params['chef_bootstrap_template'] || 'chef-client omnibus bootstrap') %>
|
app/views/unattended/snippets/_coreos_cloudconfig.erb | ||
---|---|---|
[Match]
|
||
MACAddress=<%= @host.mac %>
|
||
[Network]
|
||
<% if !@host.subnet.gateway.nil? && !@host.subnet.gateway.empty? -%>
|
||
Gateway=<%= @host.subnet.gateway %>
|
||
<% end -%>
|
||
Address=<%= @host.ip %>/<%= @host.subnet.cidr %>
|
||
<% if !@host.subnet.dns_primary.nil? && !@host.subnet.dns_primary.empty? -%>
|
||
DNS=<%= @host.subnet.dns_primary %>
|
||
<% end -%>
|
||
<% if !@host.subnet.dns_secondary.nil? && !@host.subnet.dns_secondary.empty? -%>
|
||
DNS=<%= @host.subnet.dns_secondary %>
|
||
<% end -%>
|
||
- name: down-interfaces.service
|
||
command: start
|
||
content: |
|
app/views/unattended/snippets/_kickstart_networking_setup.erb | ||
---|---|---|
GATEWAY="<%= subnet.gateway %>"
|
||
<% end -%>
|
||
<% end -%>
|
||
DEVICE="$real"
|
||
DEVICE=$real
|
||
HWADDR="<%= @host.mac -%>"
|
||
ONBOOT=yes
|
||
EOF
|
||
... | ... | |
GATEWAY="<%= subnet.gateway %>"
|
||
<% end -%>
|
||
<% end -%>
|
||
DEVICE="$real"
|
||
DEVICE=$real
|
||
ONBOOT=yes
|
||
PEERDNS=no
|
||
PEERROUTES=no
|
||
... | ... | |
<% dhcp = !subnet.nil? && subnet.dhcp_boot_mode? -%>
|
||
|
||
# <%= interface.identifier %> interface
|
||
real=`ip -o link | grep <%= interface.respond_to?(:inheriting_mac) ? interface.inheriting_mac : interface.mac -%> | awk '{print $2;}' | sed s/:$//`
|
||
real=`ip -o link | grep <%= interface.inheriting_mac -%> | awk '{print $2;}' | sed s/:$//`
|
||
<% if virtual -%>
|
||
real=`echo <%= interface.identifier -%> | sed s/<%= interface.attached_to -%>/$real/`
|
||
<% end -%>
|
||
... | ... | |
|
||
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-$sanitized_real
|
||
BOOTPROTO="none"
|
||
DEVICE="$real"
|
||
DEVICE=$real
|
||
<% unless virtual -%>
|
||
HWADDR="<%= interface.mac -%>"
|
||
<% end -%>
|
||
... | ... | |
<% dhcp = subnet.dhcp_boot_mode? -%>
|
||
|
||
# <%= interface.identifier %> interface
|
||
real=`ip -o link | grep <%= interface.mac -%> | awk '{print $2;}' | sed s/:$//`
|
||
real=`ip -o link | grep <%= interface.inheriting_mac -%> | awk '{print $2;}' | sed s/:$//`
|
||
<% if virtual -%>
|
||
real=`echo <%= interface.identifier -%> | sed s/<%= interface.attached_to -%>/$real/`
|
||
<% end -%>
|
||
... | ... | |
GATEWAY="<%= subnet.gateway %>"
|
||
<% end -%>
|
||
<% end -%>
|
||
DEVICE="$real"
|
||
DEVICE=$real
|
||
<% unless virtual -%>
|
||
HWADDR="<%= interface.mac -%>"
|
||
<% end -%>
|
app/views/unattended/snippets/_preseed_networking_setup.erb | ||
---|---|---|
<%#
|
||
kind: snippet
|
||
name: preseed_networking_setup
|
||
description: this will configure your host networking, it configures your primary interface as well
|
||
as other configures NICs. It supports physical, VLAN and Alias interfaces. It's intended to be
|
||
called in your preseed finish template.
|
||
%>
|
||
<% subnet = @host.subnet -%>
|
||
<% dhcp = subnet.dhcp_boot_mode? -%>
|
||
|
||
real=`ip -o link | grep <%= @host.mac -%> | awk '{print $2;}' | sed s/://`
|
||
cat << EOF > /etc/network/interfaces
|
||
#loopback
|
||
auto lo
|
||
iface lo inet loopback
|
||
|
||
#<%= @host.primary_interface.identifier %>
|
||
auto $real
|
||
allow-hotplug $real
|
||
iface $real inet <%= dhcp ? 'dhcp' : 'static' %>
|
||
<% unless dhcp -%>
|
||
address <%= @host.ip %>
|
||
gateway <%= @host.subnet.gateway %>
|
||
netmask <%= @host.subnet.mask %>
|
||
dns-nameservers <%= @host.subnet.dns_primary %> <%= @host.subnet.dns_secondary %>
|
||
dns-search <%= @host.domain %>
|
||
<% end %>
|
||
EOF
|
||
|
||
<% @host.managed_interfaces.each do |interface| %>
|
||
<% next if !interface.managed? || interface.subnet.nil? || interface.primary -%>
|
||
<% subnet = interface.subnet -%>
|
||
<% virtual = interface.virtual? -%>
|
||
<% dhcp = subnet.nil? ? false : subnet.dhcp_boot_mode? -%>
|
||
real=`ip -o link | grep <%= interface.mac -%> | awk '{print $2;}' | sed s/:$//`
|
||
<% if virtual -%>
|
||
real=`echo <%= interface.identifier -%> | sed s/<%= interface.physical_device -%>/$real/`
|
||
<% end -%>
|
||
|
||
cat << EOF >> /etc/network/interfaces
|
||
#<%= interface.identifier %>
|
||
auto $real
|
||
iface $real inet <%= dhcp ? 'dhcp' : 'static' %>
|
||
<% unless dhcp -%>
|
||
address <%= interface.ip %>
|
||
netmask <%= subnet.mask %>
|
||
<% end %>
|
||
EOF
|
||
<% end -%>
|
app/views/unattended/snippets/_puppet.conf.erb | ||
---|---|---|
kind: snippet
|
||
name: puppet.conf
|
||
%>
|
||
<%
|
||
if @host.param_true?('enable-puppetlabs-pc1-repo') && (@host.operatingsystem.family == 'Debian' || @host.operatingsystem.family == 'Redhat')
|
||
var_dir = '/opt/puppetlabs/puppet/cache'
|
||
log_dir = '/var/log/puppetlabs/puppet'
|
||
run_dir = '/var/run/puppetlabs'
|
||
ssl_dir = '/etc/puppetlabs/puppet/ssl'
|
||
else
|
||
if @host.operatingsystem.family == 'Freebsd'
|
||
var_dir = '/var/puppet'
|
||
else
|
||
var_dir = '/var/lib/puppet'
|
||
end
|
||
log_dir = '/var/log/puppet'
|
||
run_dir = '/var/run/puppet'
|
||
ssl_dir = '\$vardir/ssl'
|
||
end
|
||
%>
|
||
[main]
|
||
<% if @host.operatingsystem.name == 'FreeBSD' -%>
|
||
vardir = /var/puppet
|
||
logdir = \$vardir/log
|
||
<% else -%>
|
||
vardir = /var/lib/puppet
|
||
logdir = /var/log/puppet
|
||
<% end -%>
|
||
rundir = /var/run/puppet
|
||
ssldir = \$vardir/ssl
|
||
vardir = <%= var_dir %>
|
||
logdir = <%= log_dir %>
|
||
rundir = <%= run_dir %>
|
||
ssldir = <%= ssl_dir %>
|
||
|
||
[agent]
|
||
pluginsync = true
|
||
report = true
|
||
ignoreschedules = true
|
||
daemon = false
|
||
<%- if @host.puppet_ca_server.strip -%>
|
||
ca_server = <%= @host.puppet_ca_server %>
|
||
<%- end -%>
|
app/views/unattended/snippets/_puppet_setup.erb | ||
---|---|---|
<%#
|
||
kind: snippet
|
||
name: puppet_setup
|
||
description: this snippet will configure the Puppet agent
|
||
%>
|
||
<%
|
||
if @host.operatingsystem.family == 'Freebsd'
|
||
freebsd_package = @host.param_true?('enable-puppet4') ? 'puppet4' : 'puppet38'
|
||
etc_path = '/usr/local/etc/puppet'
|
||
bin_path = '/usr/local/bin'
|
||
elsif @host.param_true?('enable-puppetlabs-pc1-repo')
|
||
linux_package = 'puppet-agent'
|
||
etc_path = '/etc/puppetlabs/puppet'
|
||
bin_path = '/opt/puppetlabs/bin'
|
||
else
|
||
linux_package = 'puppet'
|
||
etc_path = '/etc/puppet'
|
||
bin_path = '/usr/bin'
|
||
end
|
||
%>
|
||
|
||
<% if @host.operatingsystem.family == 'Debian' -%>
|
||
apt-get update
|
||
apt-get install -y <%= linux_package %>
|
||
<% elsif @host.operatingsystem.family == 'Freebsd' -%>
|
||
pkg install -y <%= freebsd_package %>
|
||
<% elsif @host.operatingsystem.family == 'Redhat' -%>
|
||
yum -t -y install <%= linux_package %>
|
||
<% end -%>
|
||
|
||
cat > <%= etc_path %>/puppet.conf << EOF
|
||
<%= snippet 'puppet.conf' %>
|
||
EOF
|
||
|
||
<% unless @host.param_true?('enable-puppetlabs-pc1-repo') -%>
|
||
<% if @host.operatingsystem.family == 'Debian' -%>
|
||
if [ -f "/etc/default/puppet" ]
|
||
then
|
||
/bin/sed -i 's/^START=no/START=yes/' /etc/default/puppet
|
||
fi
|
||
/usr/bin/puppet agent --enable
|
||
<% elsif @host.operatingsystem.family == 'Freebsd' -%>
|
||
echo 'puppet_enable="YES"' >>/etc/rc.conf
|
||
<% elsif @host.operatingsystem.name == 'Fedora' -%>
|
||
puppet_unit=puppet
|
||
/usr/bin/systemctl list-unit-files | grep -q puppetagent && puppet_unit=puppetagent
|
||
/usr/bin/systemctl enable ${puppet_unit}
|
||
<% elsif @host.operatingsystem.family == 'Redhat' -%>
|
||
/sbin/chkconfig --level 345 puppet on
|
||
<% elsif @host.operatingsystem.family == 'Suse' -%>
|
||
if [ -f "/etc/sysconfig/puppet" ]
|
||
then
|
||
/usr/bin/sed -ie s/^PUPPET_SERVER=.*/PUPPET_SERVER=<%= @host.puppetmaster.blank? ? '' : @host.puppetmaster %>/ /etc/sysconfig/puppet
|
||
fi
|
||
/sbin/chkconfig puppet on -f
|
||
<% end -%>
|
||
<% end -%>
|
||
|
||
<%= bin_path %>/puppet agent --config <%= etc_path %>/puppet.conf --onetime --tags no_such_tag <%= @host.puppetmaster.blank? ? '' : "--server #{@host.puppetmaster}" %> --no-daemonize
|
app/views/unattended/snippets/_pxelinux_discovery.erb | ||
---|---|---|
<%#
|
||
kind: snippet
|
||
name: pxelinux_discovery
|
||
-%>
|
||
LABEL discovery
|
||
MENU LABEL (discovery)
|
||
KERNEL boot/fdi-image/vmlinuz0
|
||
APPEND initrd=boot/fdi-image/initrd0.img rootflags=loop root=live:/fdi.iso rootfstype=auto ro rd.live.image acpi=force rd.luks=0 rd.md=0 rd.dm=0 rd.lvm=0 rd.bootif=0 rd.neednet=0 nomodeset proxy.url=<%= foreman_server_url %> proxy.type=foreman
|
||
IPAPPEND 2
|
app/views/unattended/snippets/_redhat_register.erb | ||
---|---|---|
<% end %>
|
||
<% else %>
|
||
echo "Starting the subscription-manager registration process"
|
||
yum -t -y -e 0 install subscription-manager <%= @host.operatingsystem.major.to_i >= 6 ? 'yum-config-manager' : '' %>
|
||
yum -t -y install subscription-manager <%= @host.operatingsystem.major.to_i >= 6 ? 'yum-config-manager' : '' %>
|
||
<% if @host.operatingsystem.major.to_i >= 6 %>
|
||
<% ( enabled_repos = "yum-config-manager --enable #{@host.params['subscription_manager_repos'].gsub(',', ' ')}") if @host.params['subscription_manager_repos'] %>
|
||
<% else %>
|
app/views/unattended/snippets/_saltstack_setup.erb | ||
---|---|---|
<%#
|
||
kind: snippet
|
||
name: saltstack_setup
|
||
description: this snippet will configure the Saltstack Minion
|
||
%>
|
||
<%
|
||
etc_path = (@host.operatingsystem.family == 'Freebsd') ? '/usr/local/etc/salt' : '/etc/salt'
|
||
bin_path = (@host.operatingsystem.family == 'Freebsd') ? '/usr/local/bin' : '/usr/bin'
|
||
%>
|
||
|
||
<% if @host.operatingsystem.family == 'Debian' -%>
|
||
apt-get update
|
||
apt-get install -y salt-minion
|
||
<% elsif @host.operatingsystem.family == 'Freebsd' -%>
|
||
pkg install -y py27-salt
|
||
<% elsif @host.operatingsystem.family == 'Redhat' -%>
|
||
yum -t -y install salt-minion
|
||
<% end -%>
|
||
|
||
cat > <%= etc_path %>/minion << EOF
|
||
<%= snippet 'saltstack_minion' %>
|
||
EOF
|
||
|
||
<% if @host.operatingsystem.family == 'Freebsd' -%>
|
||
echo 'salt_minion_enable="YES"' >>/etc/rc.conf
|
||
echo 'salt_minion_paths="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"' >>/etc/rc.conf
|
||
<% elsif @host.operatingsystem.family == 'Redhat' -%>
|
||
/sbin/chkconfig --level 345 salt-minion on
|
||
<% elsif @host.operatingsystem.family == 'Suse' -%>
|
||
/sbin/chkconfig salt-minion on -f
|
||
<% end -%>
|
||
|
||
<%= bin_path %>/salt-call --no-color --grains >/dev/null
|
app/views/unattended/xenserver/PXELinux.erb | ||
---|---|---|
<%#
|
||
kind: PXELinux
|
||
name: XenServer default PXELinux
|
||
oses:
|
||
- XenServer
|
||
%>
|
||
|
||
default xenserver
|
||
label xenserver
|
||
kernel mboot.c32
|
||
append <%= @xen %> dom0_max_vcpus=1-2 dom0_mem=752M,max:752M com1=115200,8n1 console=com1,vga --- <%= @kernel -%> xencons=hvc console=hvc0 console=tty0 answerfile=<%= foreman_url('provision')%> install --- <%= @initrd %>
|
||
IPAPPEND 2
|
app/views/unattended/xenserver/disklayout.erb | ||
---|---|---|
<%#
|
||
kind: ptable
|
||
name: XenServer default
|
||
oses:
|
||
- XenServer
|
||
%>
|
||
<%
|
||
gueststorage = @host.params['gueststorage'] || 'yes'
|
||
primary_disk = @host.params['install-disk'] || 'sda'
|
||
-%>
|
||
<primary-disk gueststorage="<%= gueststorage %>"><%= primary_disk %></primary-disk>
|
app/views/unattended/xenserver/finish.erb | ||
---|---|---|
<%#
|
||
kind: finish
|
||
name: XenServer default finish
|
||
oses:
|
||
- XenServer
|
Also available in: Unified diff
templates - sync from community-templates