Created
February 17, 2016 13:45
-
-
Save ytjohn/dc78379fa7c249d19c45 to your computer and use it in GitHub Desktop.
ubuntu install with rackhd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo Starting Ubuntu x64 installer for ${hostidentifier} | |
set base-url http://<%=server%>:<%=port%>/ubuntu/dists/trusty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64 | |
kernel ${base-url}/linux | |
initrd ${base-url}/initrd.gz | |
imgargs linux auto=true DEBIAN_FRONTEND=noninteractive url=http://<%=server%>:<%=port%>/api/common/templates/ubuntu-trusty-preseed hostname=<%=hostname%> log_host=<%=server%> BOOTIF=01-<%=macaddress%> interface=auto console=tty0 console=<%=comport%>,115200n8 | |
boot || prompt --key 0x197e --timeout 2000 Press F12 to investigate || exit shell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"CIDRNet": "192.168.50.2/24", | |
"amqp": "amqp://localhost", | |
"apiServerAddress": "192.168.50.2", | |
"apiServerPort": 9080, | |
"broadcastaddr": "192.168.50.255", | |
"dhcpGateway": "192.168.50.2", | |
"dhcpProxyBindAddress": "192.168.50.2", | |
"dhcpProxyBindPort": 4011, | |
"dhcpSubnetMask": "255.255.255.0", | |
"gatewayaddr": "192.168.50.2", | |
"httpBindAddress": "0.0.0.0", | |
"httpBindPort": 8080, | |
"httpEndpoints": [ | |
{ | |
"address": "0.0.0.0", | |
"port": 8080, | |
"httpsEnabled": false, | |
"proxiesEnabled": true, | |
"authEnabled": false, | |
"routers": "northbound-api-router" | |
}, | |
{ | |
"address": "192.168.50.2", | |
"port": 9080, | |
"httpsEnabled": false, | |
"proxiesEnabled": true, | |
"authEnabled": false, | |
"routers": "southbound-api-router" | |
} | |
], | |
"httpDocsRoot": "./build/apidoc", | |
"httpEnabled": true, | |
"httpFileServiceRoot": "./static/files", | |
"httpFileServiceType": "FileSystem", | |
"httpProxies": [ | |
{ | |
"localPath": "/ubuntu/", | |
"server": "http://archive.ubuntu.com", | |
"remotePath": "/ubuntu/" | |
} | |
], | |
"httpStaticRoot": "/opt/monorail/static/http", | |
"httpsBindAddress": "0.0.0.0", | |
"httpsBindPort": 8443, | |
"httpsCert": "data/dev-cert.pem", | |
"httpsEnabled": false, | |
"httpsKey": "data/dev-key.pem", | |
"httpsPfx": null, | |
"minLogLevel": 1, | |
"mongo": "mongodb://localhost/pxe", | |
"sharedKey": "qxfO2D3tIJsZACu7UA6Fbw0avowo8r79ALzn+WeuC8M=", | |
"statsd": "127.0.0.1:8125", | |
"subnetmask": "255.255.255.0", | |
"syslogBindAddress": "192.168.50.2", | |
"syslogBindPort": 514, | |
"tftpBindAddress": "192.168.50.2", | |
"tftpBindPort": 69, | |
"tftpRoot": "/var/renasar/on-tftp/static/tftp" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### Contents of the preconfiguration file (for squeeze) | |
### Localization | |
d-i debian-installer/locale string en_US.UTF-8 | |
# d-i live-installer/net-image string http://<%=server%>:<%=port%>/ubuntu_trusty/install/filesystem.squashfs | |
# d-i live-installer/net-image string http://10.1.1.2/trusty-server-amd64/install/filesystem.squashfs | |
# this squashfs was not made for a ubuntu install, but it's compatible enough to work. | |
d-i live-installer/net-image string http://<%=server%>:<%=port%>/common/base.trusty.3.16.0-25-generic.squashfs.img | |
# Keyboard selection. | |
# Disable automatic (interactive) keymap detection. | |
d-i console-setup/ask_detect boolean false | |
d-i keyboard-configuration/layoutcode string us | |
### Network configuration | |
# Disable network configuration entirely. This is useful for cdrom | |
# installations on non-networked devices where the network questions, | |
# warning and long timeouts are a nuisance. | |
# netcfg will choose an interface that has link if possible. This makes it | |
# skip displaying a list if there is more than one interface. | |
d-i netcfg/choose_interface select auto | |
d-i netcfg/get_hostname string <%=hostname%> | |
d-i netcfg/get_domain string <%=domain%> | |
# Disable that annoying WEP key dialog. | |
d-i netcfg/wireless_wep string | |
### Mirror settings | |
# If you select ftp, the mirror/country string does not need to be set. | |
d-i mirror/country string manual | |
# server:port was necessary here | |
d-i mirror/http/hostname string <%=server%>:<%=port%> | |
d-i mirror/http/directory string /ubuntu | |
d-i apt-setup/restricted boolean false | |
d-i mirror/http/proxy string | |
d-i apt-setup/universe boolean false | |
d-i apt-setup/backports boolean false | |
d-i apt-setup/proposed boolean false | |
d-i apt-setup/security_host string | |
d-i apt-setup/local0/repository string deb http://<%=server%>:<%=port%>/ubuntu trusty main restricted universe multiverse | |
d-i apt-setup/local0/source boolean false | |
d-i debian-installer/allow_unauthenticated boolean true | |
### Clock and time zone setup | |
# Controls whether or not the hardware clock is set to UTC. | |
d-i clock-setup/utc boolean true | |
# You may set this to any valid setting for $TZ; see the contents of | |
# /usr/share/zoneinfo/ for valid values. | |
d-i time/zone string US/Pacific | |
# Controls whether to use NTP to set the clock during the install | |
d-i clock-setup/ntp boolean true | |
### Partitioning | |
d-i partman-auto/disk string /dev/sda | |
d-i partman-auto/method string lvm | |
d-i partman-lvm/device_remove_lvm boolean true | |
d-i partman-md/device_remove_md boolean true | |
d-i partman-lvm/confirm boolean true | |
d-i partman-lvm/confirm_nooverwrite boolean true | |
d-i partman-auto/init_automatically_partition \ | |
select Guided - use entire disk and set up LVM | |
d-i partman-auto-lvm/guided_size string max | |
d-i partman-auto-lvm/new_vg_name string vg00 | |
#d-i partman-auto/choose_recipe select atomic | |
# recipe should be a template substitiution | |
d-i partman-auto/choose_recipe select /lib/partman/recipes/30atomic | |
#d-i partman-auto/expert_recipe string \ | |
# boot-root :: \ | |
# 64 128 128 ext4 \ | |
# $primary{ } $bootable{ } \ | |
# method{ format } format{ } \ | |
# use_filesystem{ } filesystem{ ext4 } \ | |
# mountpoint{ /boot } \ | |
## . \ | |
# 128 512 200% linux-swap \ | |
# method{ swap } format{ } \ | |
# . \ | |
# 512 512 512 ext4 \ | |
# method{ format } format{ } $lvmok{ } \ | |
# use_filesystem{ } filesystem{ ext4 } \ | |
# mountpoint{ / } \ | |
## . \ | |
# 256 256 256 ext4 \ | |
# method{ format } format{ } $lvmok{ } \ | |
# use_filesystem{ } filesystem{ ext4 } \ | |
# mountpoint{ /home } \ | |
# . \ | |
# 256 512 512 ext4 \ | |
# method{ format } format{ } $lvmok{ } \ | |
# use_filesystem{ } filesystem{ ext4 } \ | |
# mountpoint{ /tmp } \ | |
# . \ | |
# 2048 4096 4096 ext4 \ | |
# method{ format } format{ } $lvmok{ } \ | |
# use_filesystem{ } filesystem{ ext4 } \ | |
# mountpoint{ /usr } \ | |
# . \ | |
# 2048 4096 -1 ext4 \ | |
# method{ format } format{ } $lvmok{ } \ | |
# use_filesystem{ } filesystem{ ext4 } \ | |
# mountpoint{ /var } \ | |
# . | |
# | |
d-i partman/default_filesystem string ext4 | |
d-i partman/confirm_write_new_label boolean true | |
d-i partman/choose_partition select finish | |
d-i partman/confirm boolean true | |
d-i partman/confirm_nooverwrite boolean true | |
# If you just want to change the default filesystem from ext3 to something | |
# else, you can do that without providing a full recipe. | |
d-i partman/default_filesystem string ext4 | |
### Account setup | |
# Skip creation of a root account (normal user account will be able to | |
# use sudo). The default is false; pretemplate this to true if you want to set | |
# a root password. | |
d-i passwd/root-login boolean false | |
# Alternatively, to skip creation of a normal user account. | |
#d-i passwd/make-user boolean true | |
# Root password, either in clear text | |
#d-i passwd/root-password password r00tme | |
#d-i passwd/root-password-again password r00tme | |
# or encrypted using an MD5 hash. | |
#d-i passwd/root-password-crypted password [MD5 hash] | |
# To create a normal user account. | |
d-i passwd/user-fullname string <%=username%> User | |
d-i passwd/username string <%=username%> | |
d-i passwd/user-password-crypted password $6$Qey9BDGE2c1$qNz2CArubDFY9n3qIb7spwFx9Tp.lBR9zfO/1eDyq7PTF5XwEAO8s7hcLfH5gkS/JUE0UABCutH474wkfaBII1 | |
d-i passwd/user-uid string <%=uid%> | |
d-i user-setup/encrypt-home boolean false | |
### Package selection | |
tasksel tasksel/first multiselect ubuntu-server | |
# Individual additional packages to install | |
d-i pkgsel/include string openssh-server curl | |
# Policy for applying updates. May be "none" (no automatic updates), | |
# "unattended-upgrades" (install security updates automatically), or | |
# "landscape" (manage system with Landscape). | |
d-i pkgsel/update-policy select none | |
# This is fairly safe to set, it makes grub install automatically to the MBR | |
# if no other operating system is detected on the machine. | |
d-i grub-installer/only_debian boolean true | |
# This one makes grub-installer install to the MBR if it also finds some other | |
# OS, which is less safe as it might not be able to boot that other OS. | |
d-i grub-installer/with_other_os boolean true | |
# Avoid that last message about the install being complete. | |
d-i finish-install/reboot_in_progress note | |
# Monitor autodetection is recommended. | |
xserver-xorg xserver-xorg/autodetect_monitor boolean true | |
#### Advanced options | |
### Running custom commands during the installation | |
# d-i pretemplateing is inherently not secure. Nothing in the installer checks | |
# for attempts at buffer overflows or other exploits of the values of a | |
# preconfiguration file like this one. Only use preconfiguration files from | |
# trusted locations! To drive that home, and because it's generally useful, | |
# here's a way to run any shell command you'd like inside the installer, | |
# automatically. | |
# This first command is run as early as possible, just after | |
# pretemplateing is read. | |
#d-i pretemplate/early_command string anna-install some-udeb | |
# This command is run immediately before the partitioner starts. It may be | |
# useful to apply dynamic partitioner pretemplateing that depends on the state | |
# of the disks (which may not be visible when pretemplate/early_command runs). | |
#d-i partman/early_command | |
# string debconf-set partman-auto/disk "$(list-devices disk | head -n1)" | |
# This command is run just before the install finishes, but when there is | |
# still a usable /target directory. You can chroot to /target and use it | |
# directly, or use the apt-install and in-target commands to easily install | |
# packages and run commands in the target system. | |
#d-i pretemplate/late_command string apt-install zsh; in-target chsh -s /bin/zsh | |
d-i preseed/late_command string in-target wget http://<%=server%>:<%=port%>/api/common/templates/ubuntu-trusty-sources -O /etc/apt/sources.list; in-target mkdir /home/<%=username%>/.ssh; in-target wget http://<%=server%>:<%=port%>/api/common/templates/renasar-ansible.pub -O /home/<%=username%>/.ssh/authorized_keys; in-target chown -R <%=uid%>:<%=uid%> /home/<%=username%>/.ssh; in-target /usr/sbin/useradd emc -p '$6$kS13aboz$s3V1/argaAqwpUR5xgCl3zc8x1nndOwGJfyMJMPrLBJp5TFtMY2.ymKVm.KTLWa0FAqtrQreGilBUtloK.rYr1' -s /bin/bash; cat blacklist mei >> /etc/modprobe.d/blacklist.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
re: preseed file
find anything with ubuntu_trusty in the url and change it
d-i mirror/http/hostname string <%=server%>:<%=port%> <- this was a tricky one
you have to restart on-http for the template to recompile