Revision 89eaa0b6
Added by Kamil Szubrycht over 5 years ago
db/seeds.d/020-provisioning_templates_list.rb | ||
---|---|---|
{ :name => 'AutoYaST default PXELinux', :source => 'PXELinux/autoyast_default_pxelinux.erb', :template_kind => kinds[:PXELinux], :operatingsystems => os_suse },
|
||
{ :name => 'AutoYaST default iPXE', :source => 'iPXE/autoyast_default_ipxe.erb', :template_kind => kinds[:iPXE] },
|
||
{ :name => 'AutoYaST default user data', :source => 'user_data/autoyast_default_user_data.erb', :template_kind => kinds[:user_data] },
|
||
{ :name => 'CoreOS provision', :source => 'provision/coreos_provision.erb', :template_kind => kinds[:provision]},
|
||
{ :name => 'CoreOS PXELinux', :source => 'PXELinux/coreos_pxelinux.erb', :template_kind => kinds[:PXELinux]},
|
||
{ :name => 'CoreOS provision', :source => 'provision/coreos_provision.erb', :template_kind => kinds[:provision] },
|
||
{ :name => 'CoreOS PXELinux', :source => 'PXELinux/coreos_pxelinux.erb', :template_kind => kinds[:PXELinux] },
|
||
{ :name => 'FreeBSD (mfsBSD) finish', :source => 'finish/freebsd_(mfsbsd)_finish.erb', :template_kind => kinds[:finish] },
|
||
{ :name => 'FreeBSD (mfsBSD) provision', :source => 'provision/freebsd_(mfsbsd)_provision.erb', :template_kind => kinds[:provision] },
|
||
{ :name => 'FreeBSD (mfsBSD) PXELinux', :source => 'PXELinux/freebsd_(mfsbsd)_pxelinux.erb', :template_kind => kinds[:PXELinux] },
|
lib/tasks/snapshots.rake | ||
---|---|---|
require 'database_cleaner'
|
||
require 'factory_bot_rails'
|
||
require_relative '../../test/unit/foreman/renderer/template_snapshot_service'
|
||
|
||
desc 'Snapshots tasks'
|
||
namespace :snapshots do
|
||
desc "Generate snapshots"
|
||
task :generate => :environment do
|
||
unless Rails.env.test?
|
||
puts "This task can only be run in test environment"
|
||
exit
|
||
end
|
||
|
||
DatabaseCleaner.cleaning do
|
||
ENV['FIXTURES'] = 'settings'
|
||
Rake::Task['db:fixtures:load'].invoke
|
||
|
||
User.current = FactoryBot.build(:user, :admin)
|
||
admin = FactoryBot.create(:user, :admin, password: 'password123', auth_source: FactoryBot.create(:auth_source_ldap))
|
||
|
||
User.as(admin.login) do
|
||
host = TemplateSnapshotService.host
|
||
|
||
TemplateSnapshotService.sources.each do |source|
|
||
dir = File.dirname(source.snapshot_path)
|
||
FileUtils.mkdir_p(dir) unless File.directory?(dir)
|
||
|
||
scope = Foreman::Renderer.get_scope(host: host, source: source)
|
||
snapshot = Foreman::Renderer.render(source, scope)
|
||
|
||
File.open(source.snapshot_path, 'w') { |f| f.write(snapshot) }
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
test/factories/user_related.rb | ||
---|---|---|
auth_source { AuthSourceInternal.first }
|
||
password { 'password' }
|
||
sequence(:login) {|n| "user#{n}" }
|
||
organizations { [ Organization.find_by_name('Organization 1') ] }
|
||
locations { [ Location.find_by_name('Location 1') ] }
|
||
organizations { [ Organization.find_or_initialize_by(name: 'Organization 1') ] }
|
||
locations { [ Location.find_or_initialize_by(name: 'Location 1') ] }
|
||
|
||
trait :admin do
|
||
admin { true }
|
test/unit/foreman/renderer/snapshot_source.rb | ||
---|---|---|
class SnapshotSource
|
||
SNAPSHOTS_DIRECTORY = Rails.root.join('test', 'unit', 'foreman', 'renderer', 'snapshots')
|
||
|
||
def initialize(filepath)
|
||
@filename = File.basename(filepath, '.*')
|
||
@content = File.read(filepath)
|
||
end
|
||
|
||
attr_reader :content, :template
|
||
|
||
def name
|
||
@name ||= fetch_metadata(:name, filename)
|
||
end
|
||
|
||
def snapshot_path
|
||
@snapshot_path ||= File.join(SNAPSHOTS_DIRECTORY, fetch_metadata(:model, 'undefined'),
|
||
fetch_metadata(:kind, 'undefined'), "#{name}.snap.txt")
|
||
end
|
||
|
||
def find_snippet(name)
|
||
snippet_path = Rails.root.join('app', 'views', 'unattended', 'provisioning_templates', 'snippet', "_#{name}.erb")
|
||
return unless File.file?(snippet_path)
|
||
content = File.read(snippet_path)
|
||
Template.new(name: name, template: content, snippet: true)
|
||
end
|
||
|
||
private
|
||
|
||
attr_reader :filename
|
||
|
||
def fetch_metadata(key, default = nil)
|
||
content_by_lines.find { |l| l.starts_with?("#{key}: ") }.try(:remove, "#{key}: ").try(:strip) || default
|
||
end
|
||
|
||
def content_by_lines
|
||
@content_by_lines = content.split("\n")
|
||
end
|
||
end
|
test/unit/foreman/renderer/snapshots.yaml | ||
---|---|---|
# Edit this file and then run: rake snapshots:generate RAILS_ENV=test
|
||
|
||
files:
|
||
- app/views/unattended/provisioning_templates/provision/alterator_default.erb
|
||
- app/views/unattended/provisioning_templates/PXELinux/pxelinux_global_default.erb
|
||
- app/views/unattended/provisioning_templates/PXEGrub/pxegrub_global_default.erb
|
||
- app/views/unattended/provisioning_templates/PXEGrub2/pxegrub2_global_default.erb
|
||
- app/views/unattended/provisioning_templates/PXELinux/pxelinux_default_local_boot.erb
|
||
- app/views/unattended/provisioning_templates/PXEGrub/pxegrub_default_local_boot.erb
|
||
- app/views/unattended/provisioning_templates/PXEGrub2/pxegrub2_default_local_boot.erb
|
||
- app/views/unattended/provisioning_templates/PXELinux/pxelinux_default_memdisk.erb
|
||
- app/views/unattended/provisioning_templates/PXELinux/pxelinux_chain_ipxe.erb
|
||
- app/views/unattended/provisioning_templates/PXELinux/pxelinux_chain_ipxe_undi.erb
|
||
- app/views/unattended/provisioning_templates/provision/alterator_default.erb
|
||
- app/views/unattended/provisioning_templates/finish/alterator_default_finish.erb
|
||
- app/views/unattended/provisioning_templates/provision/atomic_kickstart_default.erb
|
||
- app/views/unattended/provisioning_templates/provision/autoyast_default.erb
|
||
- app/views/unattended/provisioning_templates/provision/autoyast_sles_default.erb
|
||
- app/views/unattended/provisioning_templates/PXELinux/autoyast_default_pxelinux.erb
|
||
- app/views/unattended/provisioning_templates/user_data/autoyast_default_user_data.erb
|
||
- app/views/unattended/provisioning_templates/provision/coreos_provision.erb
|
||
- app/views/unattended/provisioning_templates/PXELinux/coreos_pxelinux.erb
|
||
- app/views/unattended/provisioning_templates/finish/freebsd_(mfsbsd)_finish.erb
|
||
- app/views/unattended/provisioning_templates/provision/freebsd_(mfsbsd)_provision.erb
|
||
- app/views/unattended/provisioning_templates/PXELinux/freebsd_(mfsbsd)_pxelinux.erb
|
||
- app/views/unattended/provisioning_templates/provision/jumpstart_default.erb
|
||
- app/views/unattended/provisioning_templates/provision/junos_default_slax.erb
|
||
- app/views/unattended/provisioning_templates/ZTP/junos_default_ztp_config.erb
|
||
- app/views/unattended/provisioning_templates/finish/junos_default_finish.erb
|
||
- app/views/unattended/provisioning_templates/provision/kickstart_default.erb
|
||
- app/views/unattended/provisioning_templates/finish/kickstart_default_finish.erb
|
||
- app/views/unattended/provisioning_templates/PXELinux/kickstart_default_pxelinux.erb
|
||
- app/views/unattended/provisioning_templates/PXEGrub/kickstart_default_pxegrub.erb
|
||
- app/views/unattended/provisioning_templates/PXEGrub2/kickstart_default_pxegrub2.erb
|
||
- app/views/unattended/provisioning_templates/user_data/kickstart_default_user_data.erb
|
||
- app/views/unattended/provisioning_templates/POAP/nx-os_default_poap_setup.erb
|
||
- app/views/unattended/provisioning_templates/provision/preseed_default.erb
|
||
- app/views/unattended/provisioning_templates/finish/preseed_default_finish.erb
|
||
- app/views/unattended/provisioning_templates/PXELinux/preseed_default_pxelinux.erb
|
||
- app/views/unattended/provisioning_templates/PXEGrub2/preseed_default_pxegrub2.erb
|
||
- app/views/unattended/provisioning_templates/user_data/preseed_default_user_data.erb
|
||
- app/views/unattended/provisioning_templates/PXELinux/rancheros_pxelinux.erb
|
||
- app/views/unattended/provisioning_templates/provision/rancheros_provision.erb
|
||
- app/views/unattended/provisioning_templates/user_data/userdata_default.erb
|
||
- app/views/unattended/provisioning_templates/PXELinux/waik_default_pxelinux.erb
|
||
- app/views/unattended/provisioning_templates/provision/xenserver_default_answerfile.erb
|
||
- app/views/unattended/provisioning_templates/finish/xenserver_default_finish.erb
|
||
- app/views/unattended/provisioning_templates/PXELinux/xenserver_default_pxelinux.erb
|
||
- app/views/unattended/provisioning_templates/snippet/_ansible_tower_callback_script.erb
|
||
- app/views/unattended/provisioning_templates/snippet/_ansible_tower_callback_service.erb
|
||
- app/views/unattended/provisioning_templates/snippet/_chef_client.erb
|
||
- app/views/unattended/provisioning_templates/snippet/_coreos_cloudconfig.erb
|
||
- app/views/unattended/provisioning_templates/snippet/_epel.erb
|
||
- app/views/unattended/provisioning_templates/snippet/_fix_hosts.erb
|
||
- app/views/unattended/provisioning_templates/snippet/_freeipa_register.erb
|
||
- app/views/unattended/provisioning_templates/snippet/_preseed_networking_setup.erb
|
||
- app/views/unattended/provisioning_templates/snippet/_puppet.conf.erb
|
||
- app/views/unattended/provisioning_templates/snippet/_puppet_setup.erb
|
||
- app/views/unattended/provisioning_templates/snippet/_pxegrub2_chainload.erb
|
||
- app/views/unattended/provisioning_templates/snippet/_pxegrub2_discovery.erb
|
||
- app/views/unattended/provisioning_templates/snippet/_pxegrub_chainload.erb
|
||
- app/views/unattended/provisioning_templates/snippet/_pxegrub_discovery.erb
|
||
- app/views/unattended/provisioning_templates/snippet/_pxelinux_chainload.erb
|
||
- app/views/unattended/provisioning_templates/snippet/_pxelinux_discovery.erb
|
||
- app/views/unattended/provisioning_templates/snippet/_rancheros_cloudconfig.erb
|
||
- app/views/unattended/provisioning_templates/snippet/_remote_execution_ssh_keys.erb
|
||
- app/views/unattended/provisioning_templates/snippet/_saltstack_minion.erb
|
||
- app/views/unattended/provisioning_templates/snippet/_saltstack_setup.erb
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/POAP/NX-OS default POAP setup.snap.txt | ||
---|---|---|
|
||
# This template file is only a placeholder. Cisco provides sample Python
|
||
# scripts for POAP, but they are only distributed through their support site.
|
||
# You will need to provide your own POAP scripts or download one from Cisco.
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXEGrub/Kickstart default PXEGrub.snap.txt | ||
---|---|---|
# This file was deployed via 'Kickstart default PXEGrub' template
|
||
|
||
|
||
default=0
|
||
timeout=10
|
||
|
||
title Kickstart default PXEGrub
|
||
root (nd)
|
||
kernel (nd)/../ ks=http://foreman.some.host.fqdn/unattended/provision network ksdevice=bootif ks.device=bootif BOOTIF=00-00-f0-54-1a-7e-e0 kssendmac ks.sendmac inst.ks.sendmac
|
||
initrd (nd)/../
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXEGrub/PXEGrub default local boot.snap.txt | ||
---|---|---|
|
||
|
||
|
||
default=0
|
||
timeout=20
|
||
|
||
|
||
fallback=1 2 3 4 5 6 7 8 9 10
|
||
|
||
title Chainload Grub from /EFI/fedora or try next
|
||
rootnoverify (hd0,0)
|
||
chainloader /EFI/fedora/grubx64.efi
|
||
|
||
title Chainload Grub from /EFI/redhat or try next
|
||
rootnoverify (hd0,0)
|
||
chainloader /EFI/redhat/grubx64.efi
|
||
|
||
title Chainload Grub from /EFI/centos or try next
|
||
rootnoverify (hd0,0)
|
||
chainloader /EFI/centos/grubx64.efi
|
||
|
||
title Chainload Grub from /EFI/debian or try next
|
||
rootnoverify (hd0,0)
|
||
chainloader /EFI/debian/grubx64.efi
|
||
|
||
title Chainload Grub from /EFI/ubuntu or try next
|
||
rootnoverify (hd0,0)
|
||
chainloader /EFI/ubuntu/grubx64.efi
|
||
|
||
title Chainload Grub from /EFI/sles or try next
|
||
rootnoverify (hd0,0)
|
||
chainloader /EFI/sles/grubx64.efi
|
||
|
||
title Chainload Grub from /EFI/opensuse or try next
|
||
rootnoverify (hd0,0)
|
||
chainloader /EFI/opensuse/grubx64.efi
|
||
|
||
title Chainload Grub from /EFI/Microsoft or try next
|
||
rootnoverify (hd0,0)
|
||
chainloader /EFI/Microsoft/grubx64.efi
|
||
|
||
title Chainload Grub from /EFI/EFI or try next
|
||
rootnoverify (hd0,0)
|
||
chainloader /EFI/EFI/grubx64.efi
|
||
|
||
title Chainload Grub from /EFI/local_chain_hd0 or try next
|
||
rootnoverify (hd0,0)
|
||
chainloader /EFI/local_chain_hd0/grubx64.efi
|
||
|
||
title Chainload into bootloader on first disk
|
||
root (hd0,0)
|
||
chainloader +1
|
||
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXEGrub/PXEGrub global default.snap.txt | ||
---|---|---|
|
||
|
||
|
||
default=0
|
||
timeout=20
|
||
|
||
|
||
fallback=1 2 3 4 5 6 7 8 9 10 11
|
||
|
||
title Chainload Grub from /EFI/fedora or try next
|
||
rootnoverify (hd0,0)
|
||
chainloader /EFI/fedora/grubx64.efi
|
||
|
||
title Chainload Grub from /EFI/redhat or try next
|
||
rootnoverify (hd0,0)
|
||
chainloader /EFI/redhat/grubx64.efi
|
||
|
||
title Chainload Grub from /EFI/centos or try next
|
||
rootnoverify (hd0,0)
|
||
chainloader /EFI/centos/grubx64.efi
|
||
|
||
title Chainload Grub from /EFI/debian or try next
|
||
rootnoverify (hd0,0)
|
||
chainloader /EFI/debian/grubx64.efi
|
||
|
||
title Chainload Grub from /EFI/ubuntu or try next
|
||
rootnoverify (hd0,0)
|
||
chainloader /EFI/ubuntu/grubx64.efi
|
||
|
||
title Chainload Grub from /EFI/sles or try next
|
||
rootnoverify (hd0,0)
|
||
chainloader /EFI/sles/grubx64.efi
|
||
|
||
title Chainload Grub from /EFI/opensuse or try next
|
||
rootnoverify (hd0,0)
|
||
chainloader /EFI/opensuse/grubx64.efi
|
||
|
||
title Chainload Grub from /EFI/Microsoft or try next
|
||
rootnoverify (hd0,0)
|
||
chainloader /EFI/Microsoft/grubx64.efi
|
||
|
||
title Chainload Grub from /EFI/EFI or try next
|
||
rootnoverify (hd0,0)
|
||
chainloader /EFI/EFI/grubx64.efi
|
||
|
||
title Chainload Grub from /EFI/local_chain_hd0 or try next
|
||
rootnoverify (hd0,0)
|
||
chainloader /EFI/local_chain_hd0/grubx64.efi
|
||
|
||
title Chainload Grub from /EFI/discovery or try next
|
||
rootnoverify (hd0,0)
|
||
chainloader /EFI/discovery/grubx64.efi
|
||
|
||
title Chainload into bootloader on first disk
|
||
root (hd0,0)
|
||
chainloader +1
|
||
|
||
|
||
# http://projects.theforeman.org/issues/15997
|
||
title Foreman Discovery Image - not supported with Grub 1.x
|
||
kernel boot/fdi-image/vmlinuz0 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=http://foreman.some.host.fqdn proxy.type=foreman BOOTIF=01-$net_default_mac
|
||
initrd boot/fdi-image/initrd0.img
|
||
|
||
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXEGrub2/Kickstart default PXEGrub2.snap.txt | ||
---|---|---|
# This file was deployed via 'Kickstart default PXEGrub2' template
|
||
|
||
|
||
set default=0
|
||
set timeout=10
|
||
|
||
menuentry 'Kickstart default PXEGrub2' {
|
||
linuxefi ks=http://foreman.some.host.fqdn/unattended/provision network ksdevice=bootif ks.device=bootif BOOTIF=00-00-f0-54-1a-7e-e0 kssendmac ks.sendmac inst.ks.sendmac BOOTIF=01-$net_default_mac
|
||
initrdefi
|
||
}
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXEGrub2/PXEGrub2 default local boot.snap.txt | ||
---|---|---|
|
||
|
||
|
||
set default=nil
|
||
set timeout=20
|
||
|
||
|
||
menuentry 'Chainload Grub2 EFI from ESP' --id local {
|
||
unset root
|
||
echo Chainloading Grub2 EFI from ESP, available devices:
|
||
ls
|
||
echo -n "Probing ESP partition ... "
|
||
search --file --no-floppy --set=root /EFI/BOOT/BOOTX64.EFI
|
||
echo found $root
|
||
sleep 2
|
||
if [ -f ($root)/EFI/BOOT/grubx64.efi ]; then
|
||
chainloader ($root)/EFI/BOOT/grubx64.efi
|
||
|
||
elif [ -f ($root)/EFI/fedora/grubx64.efi ]; then
|
||
chainloader ($root)/EFI/fedora/grubx64.efi
|
||
|
||
elif [ -f ($root)/EFI/redhat/grubx64.efi ]; then
|
||
chainloader ($root)/EFI/redhat/grubx64.efi
|
||
|
||
elif [ -f ($root)/EFI/centos/grubx64.efi ]; then
|
||
chainloader ($root)/EFI/centos/grubx64.efi
|
||
|
||
elif [ -f ($root)/EFI/debian/grubx64.efi ]; then
|
||
chainloader ($root)/EFI/debian/grubx64.efi
|
||
|
||
elif [ -f ($root)/EFI/ubuntu/grubx64.efi ]; then
|
||
chainloader ($root)/EFI/ubuntu/grubx64.efi
|
||
|
||
elif [ -f ($root)/EFI/sles/grubx64.efi ]; then
|
||
chainloader ($root)/EFI/sles/grubx64.efi
|
||
|
||
elif [ -f ($root)/EFI/opensuse/grubx64.efi ]; then
|
||
chainloader ($root)/EFI/opensuse/grubx64.efi
|
||
|
||
elif [ -f ($root)/EFI/Microsoft/grubx64.efi ]; then
|
||
chainloader ($root)/EFI/Microsoft/grubx64.efi
|
||
|
||
elif [ -f ($root)/EFI/EFI/grubx64.efi ]; then
|
||
chainloader ($root)/EFI/EFI/grubx64.efi
|
||
else
|
||
echo File grubx64.efi not found on ESP.
|
||
echo Update 'pxegrub2_chainload' paths array with:
|
||
ls ($root)/EFI
|
||
echo The system will halt in 2 minutes or
|
||
echo press ESC to halt immediately.
|
||
sleep -i 120
|
||
halt --no-apm
|
||
fi
|
||
}
|
||
|
||
menuentry 'Chainload into BIOS bootloader on first disk' --id local_chain_hd0 {
|
||
set root=(hd0,0)
|
||
chainloader +1
|
||
}
|
||
|
||
menuentry 'Chainload into BIOS bootloader on second disk' --id local_chain_hd1 {
|
||
set root=(hd1,0)
|
||
chainloader +1
|
||
}
|
||
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXEGrub2/PXEGrub2 global default.snap.txt | ||
---|---|---|
|
||
|
||
|
||
default=nil
|
||
timeout=20
|
||
|
||
# On Debian/Ubuntu grub2 does not have patch for loading MAC-based configs. Also due to bug
|
||
# in RHEL 7.4 files are loaded with an extra ":" character at the end. This workarounds both
|
||
# cases, make sure "regexp.mod" file is present on the TFTP. For more info see:
|
||
# https://bugzilla.redhat.com/show_bug.cgi?id=1370642#c70
|
||
insmod regexp
|
||
regexp --set=1:m1 --set=2:m2 --set=3:m3 --set=4:m4 --set=5:m5 --set=6:m6 '^([0-9a-f]{1,2})\:([0-9a-f]{1,2})\:([0-9a-f]{1,2})\:([0-9a-f]{1,2})\:([0-9a-f]{1,2})\:([0-9a-f]{1,2})' "$net_default_mac"
|
||
mac=${m1}-${m2}-${m3}-${m4}-${m5}-${m6}
|
||
configfile=/grub2/grub.cfg-01-$mac
|
||
source "$configfile"
|
||
|
||
|
||
menuentry 'Chainload Grub2 EFI from ESP' --id local {
|
||
unset root
|
||
echo Chainloading Grub2 EFI from ESP, available devices:
|
||
ls
|
||
echo -n "Probing ESP partition ... "
|
||
search --file --no-floppy --set=root /EFI/BOOT/BOOTX64.EFI
|
||
echo found $root
|
||
sleep 2
|
||
if [ -f ($root)/EFI/BOOT/grubx64.efi ]; then
|
||
chainloader ($root)/EFI/BOOT/grubx64.efi
|
||
|
||
elif [ -f ($root)/EFI/fedora/grubx64.efi ]; then
|
||
chainloader ($root)/EFI/fedora/grubx64.efi
|
||
|
||
elif [ -f ($root)/EFI/redhat/grubx64.efi ]; then
|
||
chainloader ($root)/EFI/redhat/grubx64.efi
|
||
|
||
elif [ -f ($root)/EFI/centos/grubx64.efi ]; then
|
||
chainloader ($root)/EFI/centos/grubx64.efi
|
||
|
||
elif [ -f ($root)/EFI/debian/grubx64.efi ]; then
|
||
chainloader ($root)/EFI/debian/grubx64.efi
|
||
|
||
elif [ -f ($root)/EFI/ubuntu/grubx64.efi ]; then
|
||
chainloader ($root)/EFI/ubuntu/grubx64.efi
|
||
|
||
elif [ -f ($root)/EFI/sles/grubx64.efi ]; then
|
||
chainloader ($root)/EFI/sles/grubx64.efi
|
||
|
||
elif [ -f ($root)/EFI/opensuse/grubx64.efi ]; then
|
||
chainloader ($root)/EFI/opensuse/grubx64.efi
|
||
|
||
elif [ -f ($root)/EFI/Microsoft/grubx64.efi ]; then
|
||
chainloader ($root)/EFI/Microsoft/grubx64.efi
|
||
|
||
elif [ -f ($root)/EFI/EFI/grubx64.efi ]; then
|
||
chainloader ($root)/EFI/EFI/grubx64.efi
|
||
else
|
||
echo File grubx64.efi not found on ESP.
|
||
echo Update 'pxegrub2_chainload' paths array with:
|
||
ls ($root)/EFI
|
||
echo The system will halt in 2 minutes or
|
||
echo press ESC to halt immediately.
|
||
sleep -i 120
|
||
halt --no-apm
|
||
fi
|
||
}
|
||
|
||
menuentry 'Chainload into BIOS bootloader on first disk' --id local_chain_hd0 {
|
||
set root=(hd0,0)
|
||
chainloader +1
|
||
}
|
||
|
||
menuentry 'Chainload into BIOS bootloader on second disk' --id local_chain_hd1 {
|
||
set root=(hd1,0)
|
||
chainloader +1
|
||
}
|
||
|
||
|
||
menuentry 'Foreman Discovery Image' --id discovery {
|
||
linuxefi boot/fdi-image/vmlinuz0 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=http://foreman.some.host.fqdn proxy.type=foreman BOOTIF=01-$mac
|
||
initrdefi boot/fdi-image/initrd0.img
|
||
}
|
||
|
||
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXEGrub2/Preseed default PXEGrub2.snap.txt | ||
---|---|---|
|
||
#
|
||
# This file was deployed via 'Preseed default PXEGrub2' template
|
||
#
|
||
# Supported host/hostgroup parameters:
|
||
#
|
||
# blacklist = module1, module2
|
||
# Blacklisted kernel modules
|
||
#
|
||
# lang = en_US
|
||
# System locale
|
||
#
|
||
set default=0
|
||
set timeout=10
|
||
|
||
menuentry 'Preseed default PXEGrub2' {
|
||
linux interface=auto url=http://foreman.some.host.fqdn/unattended/provision ramdisk_size=10800 root=/dev/rd/0 rw auto hostname=snapshothost console-setup/ask_detect=false console-setup/layout=USA console-setup/variant=USA keyboard-configuration/layoutcode=us localechooser/translation/warn-light=true localechooser/translation/warn-severe=true locale=en_US BOOTIF=01-$net_default_mac
|
||
initrd
|
||
}
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXELinux/AutoYaST default PXELinux.snap.txt | ||
---|---|---|
|
||
|
||
DEFAULT linux
|
||
|
||
LABEL linux
|
||
KERNEL
|
||
APPEND initrd= ramdisk_size=65536 install= autoyast=http://foreman.some.host.fqdn/unattended/provision textmode=1
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXELinux/CoreOS PXELinux.snap.txt | ||
---|---|---|
|
||
DEFAULT coreos
|
||
|
||
LABEL coreos
|
||
KERNEL
|
||
APPEND initrd= cloud-config-url=http://foreman.some.host.fqdn/unattended/provision
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXELinux/FreeBSD (mfsBSD) PXELinux.snap.txt | ||
---|---|---|
|
||
# foreman_url=http://foreman.some.host.fqdn/unattended/provision
|
||
DEFAULT freebsd
|
||
|
||
LABEL freebsd
|
||
KERNEL memdisk
|
||
APPEND initrd= harddisk raw
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXELinux/Kickstart default PXELinux.snap.txt | ||
---|---|---|
# This file was deployed via 'Kickstart default PXELinux' template
|
||
|
||
|
||
DEFAULT menu
|
||
MENU TITLE Booting into OS installer (ESC to stop)
|
||
TIMEOUT 100
|
||
ONTIMEOUT installer
|
||
|
||
LABEL installer
|
||
MENU LABEL Kickstart default PXELinux
|
||
KERNEL
|
||
APPEND initrd= ks=http://foreman.some.host.fqdn/unattended/provision network ksdevice=bootif ks.device=bootif BOOTIF=00-00-f0-54-1a-7e-e0 kssendmac ks.sendmac inst.ks.sendmac
|
||
IPAPPEND 2
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXELinux/PXELinux chain iPXE UNDI.snap.txt | ||
---|---|---|
|
||
|
||
DEFAULT linux
|
||
LABEL linux
|
||
KERNEL undionly-ipxe.0
|
||
IPAPPEND 2
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXELinux/PXELinux chain iPXE.snap.txt | ||
---|---|---|
|
||
|
||
DEFAULT linux
|
||
LABEL linux
|
||
KERNEL ipxe.lkrn
|
||
APPEND dhcp && chain http://foreman.some.host.fqdn/unattended/iPXE
|
||
IPAPPEND 2
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXELinux/PXELinux default local boot.snap.txt | ||
---|---|---|
|
||
|
||
|
||
DEFAULT menu
|
||
MENU TITLE Booting local disk (ESC to stop)
|
||
TIMEOUT 200
|
||
DEFAULT nil
|
||
|
||
|
||
LABEL local
|
||
MENU LABEL Default local boot
|
||
MENU DEFAULT
|
||
LOCALBOOT 0
|
||
|
||
LABEL local_primary
|
||
MENU LABEL Default local boot from primary hard drive
|
||
LOCALBOOT 0x80
|
||
|
||
LABEL local_skip
|
||
MENU LABEL Boot from the next BIOS device
|
||
LOCALBOOT -1
|
||
|
||
LABEL local_chain_hd0
|
||
MENU LABEL Chainload the first hard drive (hd0)
|
||
COM32 chain.c32
|
||
APPEND hd0
|
||
|
||
LABEL local_chain_hd1
|
||
MENU LABEL Chainload the second hard drive (hd1)
|
||
COM32 chain.c32
|
||
APPEND hd1
|
||
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXELinux/PXELinux default memdisk.snap.txt | ||
---|---|---|
|
||
DEFAULT memdisk
|
||
|
||
LABEL memdisk
|
||
KERNEL memdisk
|
||
APPEND initrd= harddisk raw
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXELinux/PXELinux global default.snap.txt | ||
---|---|---|
|
||
|
||
|
||
DEFAULT menu
|
||
MENU TITLE Booting unknown host (ESC to stop)
|
||
TIMEOUT 200
|
||
ONTIMEOUT nil
|
||
|
||
|
||
LABEL local
|
||
MENU LABEL Default local boot
|
||
MENU DEFAULT
|
||
LOCALBOOT 0
|
||
|
||
LABEL local_primary
|
||
MENU LABEL Default local boot from primary hard drive
|
||
LOCALBOOT 0x80
|
||
|
||
LABEL local_skip
|
||
MENU LABEL Boot from the next BIOS device
|
||
LOCALBOOT -1
|
||
|
||
LABEL local_chain_hd0
|
||
MENU LABEL Chainload the first hard drive (hd0)
|
||
COM32 chain.c32
|
||
APPEND hd0
|
||
|
||
LABEL local_chain_hd1
|
||
MENU LABEL Chainload the second hard drive (hd1)
|
||
COM32 chain.c32
|
||
APPEND hd1
|
||
|
||
|
||
LABEL discovery
|
||
MENU LABEL Foreman Discovery Image
|
||
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=http://foreman.some.host.fqdn proxy.type=foreman
|
||
IPAPPEND 2
|
||
|
||
LABEL discovery_ipxe
|
||
MENU LABEL Foreman Discovery Image - iPXE
|
||
KERNEL ipxe.lkrn
|
||
APPEND dhcp && chain http://foreman.some.host.fqdn/pub/discovery.ipxe
|
||
|
||
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXELinux/Preseed default PXELinux.snap.txt | ||
---|---|---|
|
||
#
|
||
# This file was deployed via 'Preseed default PXELinux' template
|
||
#
|
||
# Supported host/hostgroup parameters:
|
||
#
|
||
# blacklist = module1, module2
|
||
# Blacklisted kernel modules
|
||
#
|
||
# lang = en_US
|
||
# System locale
|
||
#
|
||
|
||
DEFAULT linux
|
||
|
||
LABEL linux
|
||
KERNEL
|
||
APPEND initrd= interface=auto url=http://foreman.some.host.fqdn/unattended/provision ramdisk_size=10800 root=/dev/rd/0 rw auto hostname=snapshothost console-setup/ask_detect=false console-setup/layout=USA console-setup/variant=USA keyboard-configuration/layoutcode=us localechooser/translation/warn-light=true localechooser/translation/warn-severe=true locale=en_US
|
||
IPAPPEND 2
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXELinux/RancherOS PXELinux.snap.txt | ||
---|---|---|
DEFAULT rancheros
|
||
|
||
LABEL rancheros
|
||
KERNEL rancher.state.dev=LABEL=RANCHER_STATE rancher.state.autoformat=[/dev/sda] rancher.cloud_init.datasources=['url:http://foreman.some.host.fqdn/unattended/provision']
|
||
APPEND initrd=
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXELinux/WAIK default PXELinux.snap.txt | ||
---|---|---|
|
||
DEFAULT winPE
|
||
|
||
LABEL winPE
|
||
KERNEL /Boot/startrom.0
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/PXELinux/XenServer default PXELinux.snap.txt | ||
---|---|---|
|
||
default xenserver
|
||
label xenserver
|
||
kernel mboot.c32
|
||
append dom0_max_vcpus=1-2 dom0_mem=752M,max:752M com1=115200,8n1 console=com1,vga --- xencons=hvc console=hvc0 console=tty0 answerfile=http://foreman.some.host.fqdn/unattended/provision install ---
|
||
IPAPPEND 2
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/ZTP/Junos default ZTP config.snap.txt | ||
---|---|---|
system {
|
||
host-name ;
|
||
root-authentication {
|
||
encrypted-password "xybxa6JUkz63w"; ## SECRET-DATA
|
||
}
|
||
services {
|
||
ssh;
|
||
netconf {
|
||
ssh;
|
||
}
|
||
}
|
||
syslog {
|
||
user * {
|
||
any emergency;
|
||
user info;
|
||
}
|
||
file messages {
|
||
any notice;
|
||
authorization info;
|
||
}
|
||
console {
|
||
user info;
|
||
}
|
||
}
|
||
}
|
||
interfaces {
|
||
vme {
|
||
unit 0 {
|
||
family inet {
|
||
dhcp;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
event-options {
|
||
generate-event {
|
||
fmztp time-interval 90;
|
||
}
|
||
policy fmztp {
|
||
events fmztp;
|
||
then {
|
||
execute-commands {
|
||
commands {
|
||
"op url http://foreman.some.host.fqdn/unattended/provision.slax";
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
protocols {
|
||
igmp-snooping {
|
||
vlan all;
|
||
}
|
||
rstp;
|
||
lldp {
|
||
interface all;
|
||
}
|
||
lldp-med {
|
||
interface all;
|
||
}
|
||
}
|
||
ethernet-switching-options {
|
||
storm-control {
|
||
interface all;
|
||
}
|
||
}
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/finish/Alterator default finish.snap.txt | ||
---|---|---|
#!/bin/sh
|
||
|
||
|
||
echo "" > /etc/hostname
|
||
hostname
|
||
cat > /etc/hosts << EOF
|
||
127.0.0.1 snapshothost localhost localhost.localdomain
|
||
::1 ip6-localhost ip6-loopback
|
||
fe00::0 ip6-localnet
|
||
ff00::0 ip6-mcastprefix
|
||
ff02::1 ip6-allnodes
|
||
ff02::2 ip6-allrouters
|
||
EOF
|
||
|
||
|
||
apt-get update >/dev/null 2>/dev/null
|
||
apt-get -y install puppet >/dev/null 2>/dev/null
|
||
|
||
|
||
cat > /etc/puppet/puppet.conf << EOF
|
||
|
||
|
||
[main]
|
||
vardir = /var/lib/puppet
|
||
logdir = /var/log/puppet
|
||
rundir = /var/run/puppet
|
||
ssldir = \$vardir/ssl
|
||
|
||
[agent]
|
||
pluginsync = true
|
||
report = true
|
||
ignoreschedules = true
|
||
ca_server =
|
||
certname = snapshothost
|
||
environment =
|
||
server =
|
||
EOF
|
||
|
||
/usr/bin/puppet agent --config /etc/puppet/puppet.conf -o --tags no_such_tag --server --no-daemonize
|
||
/usr/bin/wget -q -O /dev/null --no-check-certificate http://foreman.some.host.fqdn/unattended/built
|
||
/sbin/chkconfig puppetd on
|
||
|
||
exit 0
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/finish/FreeBSD (mfsBSD) finish.snap.txt | ||
---|---|---|
|
||
|
||
/bin/echo 'xybxa6JUkz63w' | pw usermod root -H 0
|
||
cat >> /etc/rc.conf <<EOF
|
||
hostname="snapshothost"
|
||
sshd_enable="YES"
|
||
ntpd_enable="YES"
|
||
EOF
|
||
|
||
echo ifconfig_`ifconfig -l | cut -d ' ' -f 1`=DHCP >>/etc/rc.conf
|
||
|
||
echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
|
||
|
||
/bin/hostname snapshothost
|
||
cp /usr/share/zoneinfo/UTC /etc/localtime
|
||
adjkerntz -a
|
||
ntpdate 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
|
||
|
||
|
||
|
||
# SSH keys setup snippet for Remote Execution plugin
|
||
#
|
||
# Parameters:
|
||
#
|
||
# remote_execution_ssh_keys: public keys to be put in ~/.ssh/authorized_keys
|
||
#
|
||
# remote_execution_ssh_user: user for which remote_execution_ssh_keys will be
|
||
# authorized
|
||
#
|
||
# remote_execution_create_user: create user if it not already existing
|
||
#
|
||
# remote_execution_effective_user_method: method to switch from ssh user to
|
||
# effective user
|
||
#
|
||
# This template sets up SSH keys in any host so that as long as your public
|
||
# SSH key is in remote_execution_ssh_keys, you can SSH into a host. This
|
||
# works in combination with Remote Execution plugin by querying smart proxies
|
||
# to build an array.
|
||
#
|
||
# To use this snippet without the plugin provide the SSH keys as host parameter
|
||
# remote_execution_ssh_keys. It expects the same format like the authorized_keys
|
||
# file.
|
||
|
||
|
||
|
||
|
||
exit 0
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/finish/Junos default finish.snap.txt | ||
---|---|---|
system {
|
||
host-name snapshothost;
|
||
time-zone Etc/UTC;
|
||
root-authentication {
|
||
encrypted-password "xybxa6JUkz63w"; ## SECRET-DATA
|
||
}
|
||
name-server {
|
||
8.8.8.8;
|
||
}
|
||
ntp {
|
||
boot-server 0.pool.ntp.org;
|
||
server 0.pool.ntp.org;
|
||
}
|
||
login {
|
||
message "This device was provisioned by using The Foreman!\nSee http://theforeman.org/ for further information.\n";
|
||
class automation {
|
||
permissions all;
|
||
}
|
||
user puppet {
|
||
uid 2001;
|
||
class automation;
|
||
authentication {
|
||
encrypted-password "xybxa6JUkz63w"; ## SECRET-DATA
|
||
}
|
||
shell csh;
|
||
}
|
||
}
|
||
services {
|
||
ssh {
|
||
protocol-version v2;
|
||
}
|
||
netconf {
|
||
ssh;
|
||
}
|
||
}
|
||
syslog {
|
||
user * {
|
||
any emergency;
|
||
}
|
||
file messages {
|
||
any notice;
|
||
authorization info;
|
||
}
|
||
file interactive-commands {
|
||
interactive-commands any;
|
||
}
|
||
}
|
||
ntp {
|
||
boot-server 0.pool.ntp.org;
|
||
server 0.pool.ntp.org;
|
||
server 1.pool.ntp.org;
|
||
}
|
||
extensions {
|
||
providers {
|
||
juniper {
|
||
license-type juniper deployment-scope commercial;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
chassis {
|
||
alarm {
|
||
management-ethernet {
|
||
link-down ignore;
|
||
}
|
||
}
|
||
}
|
||
interfaces {
|
||
interface-range ACCESS-PORT {
|
||
member ge-0/0/0;
|
||
unit 0 {
|
||
family ethernet-switching {
|
||
port-mode access;
|
||
}
|
||
}
|
||
}
|
||
interface-range UPLINK-PORT {
|
||
member ge-0/0/47;
|
||
unit 0 {
|
||
family ethernet-switching {
|
||
port-mode trunk;
|
||
vlan {
|
||
members all;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
vlan {
|
||
unit 37 {
|
||
family inet;
|
||
}
|
||
}
|
||
vme {
|
||
unit 0 {
|
||
family inet {
|
||
dhcp;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
protocols {
|
||
igmp-snooping {
|
||
vlan all;
|
||
}
|
||
rstp;
|
||
lldp {
|
||
interface all;
|
||
}
|
||
lldp-med {
|
||
interface all;
|
||
}
|
||
}
|
||
ethernet-switching-options {
|
||
storm-control {
|
||
interface all;
|
||
}
|
||
bpdu-block {
|
||
interface ACCESS-PORT;
|
||
disable-timeout 120;
|
||
}
|
||
}
|
||
vlans {
|
||
testlan {
|
||
vlan-id 37;
|
||
l3-interface vlan.37;
|
||
}
|
||
}
|
||
groups {
|
||
fmztp {
|
||
apply-macro conf {
|
||
package jinstall-ex-4200-7R-domestic-signed.tgz;
|
||
puppet jpuppet-ex-1.0R1.1.tgz;
|
||
}
|
||
}
|
||
}
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/finish/Kickstart default finish.snap.txt | ||
---|---|---|
|
||
|
||
|
||
|
||
|
||
service network restart
|
||
|
||
|
||
|
||
|
||
|
||
#update local time
|
||
echo "updating system time"
|
||
yum -y install ntpdate
|
||
/usr/sbin/ntpdate -sub 0.fedora.pool.ntp.org
|
||
/usr/sbin/hwclock --systohc
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
# update all the base packages from the updates repository
|
||
if [ -f /usr/bin/dnf ]; then
|
||
dnf -y update
|
||
else
|
||
yum -t -y update
|
||
fi
|
||
|
||
|
||
# SSH keys setup snippet for Remote Execution plugin
|
||
#
|
||
# Parameters:
|
||
#
|
||
# remote_execution_ssh_keys: public keys to be put in ~/.ssh/authorized_keys
|
||
#
|
||
# remote_execution_ssh_user: user for which remote_execution_ssh_keys will be
|
||
# authorized
|
||
#
|
||
# remote_execution_create_user: create user if it not already existing
|
||
#
|
||
# remote_execution_effective_user_method: method to switch from ssh user to
|
||
# effective user
|
||
#
|
||
# This template sets up SSH keys in any host so that as long as your public
|
||
# SSH key is in remote_execution_ssh_keys, you can SSH into a host. This
|
||
# works in combination with Remote Execution plugin by querying smart proxies
|
||
# to build an array.
|
||
#
|
||
# To use this snippet without the plugin provide the SSH keys as host parameter
|
||
# remote_execution_ssh_keys. It expects the same format like the authorized_keys
|
||
# file.
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
sync
|
||
|
||
exit 0
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/finish/Preseed default finish.snap.txt | ||
---|---|---|
|
||
|
||
|
||
|
||
|
||
|
||
# SSH keys setup snippet for Remote Execution plugin
|
||
#
|
||
# Parameters:
|
||
#
|
||
# remote_execution_ssh_keys: public keys to be put in ~/.ssh/authorized_keys
|
||
#
|
||
# remote_execution_ssh_user: user for which remote_execution_ssh_keys will be
|
||
# authorized
|
||
#
|
||
# remote_execution_create_user: create user if it not already existing
|
||
#
|
||
# remote_execution_effective_user_method: method to switch from ssh user to
|
||
# effective user
|
||
#
|
||
# This template sets up SSH keys in any host so that as long as your public
|
||
# SSH key is in remote_execution_ssh_keys, you can SSH into a host. This
|
||
# works in combination with Remote Execution plugin by querying smart proxies
|
||
# to build an array.
|
||
#
|
||
# To use this snippet without the plugin provide the SSH keys as host parameter
|
||
# remote_execution_ssh_keys. It expects the same format like the authorized_keys
|
||
# file.
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
real=`ip -o link | awk '/00-f0-54-1a-7e-e0/ {print $2;}' | sed s/://`
|
||
cat << EOF > /etc/network/interfaces
|
||
#loopback
|
||
auto lo
|
||
iface lo inet loopback
|
||
|
||
#eth0
|
||
auto $real
|
||
allow-hotplug $real
|
||
iface $real inet dhcp
|
||
EOF
|
||
|
||
|
||
/usr/bin/wget --no-proxy --quiet --output-document=/dev/null --no-check-certificate http://foreman.some.host.fqdn/unattended/built
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/finish/XenServer default finish.snap.txt | ||
---|---|---|
#!/bin/bash
|
||
/usr/bin/wget --output-document=/dev/null http://foreman.some.host.fqdn/unattended/built
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/provision/Alterator default.snap.txt | ||
---|---|---|
("/sysconfig-base/language" action "write" lang ("en_US"))
|
||
("/sysconfig-base/kbd" action "write" layout "ctrl_shift_toggle")
|
||
("/datetime-installer" action "write" commit #t name "RU" zone "Europe/Moscow" utc #t)
|
||
("/evms/control" action "write" control open installer #t)
|
||
("/evms/control" action "write" control update)
|
||
("/evms/profiles/server" action apply commit #f clearall #t exclude ())
|
||
("/evms/control" action "write" control commit)
|
||
("/evms/control" action "write" control close)
|
||
("/pkg-init" action "write")
|
||
("/pkg-install" action "write" lists "" auto #t)
|
||
("/preinstall" action "write")
|
||
("/grub" action "write" language ("en_US") device "/dev/sda")
|
||
("/net-eth" action "write" reset #t)
|
||
("/net-eth" action "write" name "eth0" configuration "static" default "" search "snapshotdomain.com" dns " " computer_name "snapshothost")
|
||
("/net-eth" action "add_iface_address" name "eth0" addip "127.0.0.1" addmask "255.255.255.0")
|
||
("/net-eth" action "write" commit #t)
|
||
("/root/change_password" language (en_US") passwd_2 "123" passwd_1 "123")
|
||
("/postinstall/firsttime" action "write" method "url" url "http://foreman.some.host.fqdn/unattended/finish")
|
||
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/provision/Atomic Kickstart default.snap.txt | ||
---|---|---|
|
||
|
||
lang en_US.UTF-8
|
||
keyboard us
|
||
timezone --utc UTC
|
||
|
||
|
||
network --bootproto dhcp --hostname snapshothost --device=00-f0-54-1a-7e-e0
|
||
# Partition table should create /boot and a volume atomicos
|
||
zerombr\nclearpart --all --initlabel\npart /boot --fstype ext3 --size=100 --asprimary\npart / --f stype ext3 --size=1024 --grow\npart swap --recommended
|
||
|
||
bootloader --timeout=3
|
||
text
|
||
|
||
ostreesetup --nogpg --osname=rhel-atomic-host --remote=rhel-atomic-host --url=file:///install/ostree --ref=rhel-atomic-host/7/x86_64/standard
|
||
services --disabled cloud-init,cloud-config,cloud-final,cloud-init-local
|
||
rootpw --iscrypted xybxa6JUkz63w
|
||
|
||
reboot
|
||
|
||
%post
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
# SSH keys setup snippet for Remote Execution plugin
|
||
#
|
||
# Parameters:
|
||
#
|
||
# remote_execution_ssh_keys: public keys to be put in ~/.ssh/authorized_keys
|
||
#
|
||
# remote_execution_ssh_user: user for which remote_execution_ssh_keys will be
|
||
# authorized
|
||
#
|
||
# remote_execution_create_user: create user if it not already existing
|
||
#
|
||
# remote_execution_effective_user_method: method to switch from ssh user to
|
||
# effective user
|
||
#
|
||
# This template sets up SSH keys in any host so that as long as your public
|
||
# SSH key is in remote_execution_ssh_keys, you can SSH into a host. This
|
||
# works in combination with Remote Execution plugin by querying smart proxies
|
||
# to build an array.
|
||
#
|
||
# To use this snippet without the plugin provide the SSH keys as host parameter
|
||
# remote_execution_ssh_keys. It expects the same format like the authorized_keys
|
||
# file.
|
||
|
||
|
||
|
||
|
||
(
|
||
# Report success back to Foreman
|
||
curl -s -o /dev/null --insecure http://foreman.some.host.fqdn/unattended/built
|
||
) 2>&1 | tee /mnt/sysimage/root/install.post.log
|
||
|
||
exit 0
|
||
|
||
%end
|
test/unit/foreman/renderer/snapshots/ProvisioningTemplate/provision/AutoYaST SLES default.snap.txt | ||
---|---|---|
<?xml version="1.0" encoding="UTF-8"?>
|
||
<!DOCTYPE profile>
|
||
<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
|
||
<general>
|
||
<mode>
|
||
<confirm config:type="boolean">false</confirm>
|
||
<final_reboot config:type="boolean">true</final_reboot>
|
||
</mode>
|
||
</general>
|
||
<networking>
|
||
<dns>
|
||
<hostname>snapshothost</hostname>
|
||
<resolv_conf_policy>auto</resolv_conf_policy>
|
||
<searchlist config:type="list">
|
||
<search>snapshotdomain.com</search>
|
||
</searchlist>
|
||
</dns>
|
||
<interfaces config:type="list">
|
||
</interfaces>
|
||
</networking>
|
||
<ntp-client>
|
||
<configure_dhcp config:type="boolean">false</configure_dhcp>
|
||
<peers config:type="list">
|
||
<peer>
|
||
<address>0.opensuse.pool.ntp.org</address>
|
||
<initial_sync config:type="boolean">true</initial_sync>
|
||
<options></options>
|
||
<type>server</type>
|
||
</peer>
|
||
</peers>
|
||
<start_at_boot config:type="boolean">true</start_at_boot>
|
||
<start_in_chroot config:type="boolean">true</start_in_chroot>
|
||
</ntp-client>
|
||
zerombr\nclearpart --all --initlabel\npart /boot --fstype ext3 --size=100 --asprimary\npart / --f stype ext3 --size=1024 --grow\npart swap --recommended
|
||
<runlevel>
|
||
<default>3</default>
|
||
<services config:type="list">
|
||
<service>
|
||
<service_name>sshd</service_name>
|
||
<service_status>enable</service_status>
|
||
</service>
|
||
</services>
|
||
</runlevel>
|
||
<software>
|
||
<patterns config:type="list">
|
||
<pattern>Minimal</pattern>
|
||
</patterns>
|
||
<packages config:type="list">
|
||
<package>lsb-release</package>
|
||
<package>openssh</package>
|
||
</packages>
|
||
</software>
|
||
<users config:type="list">
|
||
<user>
|
||
<username>root</username>
|
||
<encrypted config:type="boolean">true</encrypted>
|
||
<fullname>root</fullname>
|
||
<gid>0</gid>
|
||
<home>/root</home>
|
||
<shell>/bin/bash</shell>
|
||
<uid>0</uid>
|
||
<user_password>xybxa6JUkz63w</user_password>
|
||
</user>
|
||
</users>
|
||
<scripts>
|
||
<chroot-scripts config:type="list">
|
||
<script>
|
||
<filename>cp-resolv.sh</filename>
|
||
<chrooted config:type="boolean">false</chrooted>
|
||
<interpreter>shell</interpreter>
|
||
<notification>Copying resolv.conf into chroot ...</notification>
|
||
<source><![CDATA[
|
||
cp /etc/resolv.conf /mnt/etc
|
||
]]>
|
||
</source>
|
||
</script>
|
||
<script>
|
||
<filename>foreman.sh</filename>
|
||
<chrooted config:type="boolean">true</chrooted>
|
||
<interpreter>shell</interpreter>
|
||
<notification>Setting up Puppet / Foreman ...</notification>
|
||
<source><![CDATA[
|
||
/bin/hostname snapshothost
|
||
|
||
|
||
# SSH keys setup snippet for Remote Execution plugin
|
||
#
|
||
# Parameters:
|
||
#
|
||
# remote_execution_ssh_keys: public keys to be put in ~/.ssh/authorized_keys
|
||
#
|
||
# remote_execution_ssh_user: user for which remote_execution_ssh_keys will be
|
||
# authorized
|
||
#
|
||
# remote_execution_create_user: create user if it not already existing
|
||
#
|
||
# remote_execution_effective_user_method: method to switch from ssh user to
|
||
# effective user
|
||
#
|
||
# This template sets up SSH keys in any host so that as long as your public
|
||
# SSH key is in remote_execution_ssh_keys, you can SSH into a host. This
|
||
# works in combination with Remote Execution plugin by querying smart proxies
|
||
# to build an array.
|
||
#
|
||
# To use this snippet without the plugin provide the SSH keys as host parameter
|
||
# remote_execution_ssh_keys. It expects the same format like the authorized_keys
|
||
# file.
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
/usr/bin/curl -o /dev/null -k 'http://foreman.some.host.fqdn/unattended/built'
|
||
|
||
rm /etc/resolv.conf
|
||
]]>
|
||
</source>
|
||
</script>
|
||
</chroot-scripts>
|
||
</scripts>
|
||
<keyboard>
|
||
<keymap>english-us</keymap>
|
||
</keyboard>
|
||
<timezone>
|
||
<hwclock>UTC</hwclock>
|
||
<timezone>Etc/UTC</timezone>
|
||
</timezone>
|
||
<add-on>
|
||
<add_on_products config:type="list">
|
Also available in: Unified diff
Fixes #24294 - add snapshot tests for templates