Skip to content
This repository was archived by the owner on Jun 4, 2021. It is now read-only.

Commit 294a756

Browse files
committed
Modifies Ubuntu 18.04 task to enable node registration.
* Modifies stages to get the ubuntu 18.04 nodes to register. * Changes startup method after first boot to use cron. fix for PR based on comments
1 parent fce5105 commit 294a756

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
echo Razor policy successfully applied > /tmp/razor_complete.log
4+
echo Installed using <%= task.label %> - <%= task.description %> >> /tmp/razor_complete.log
5+
echo Repo: <%= repo_url %> >> /tmp/razor_complete.log
6+
echo Node: <%= node_url %> >> /tmp/razor_complete.log
7+
8+
sed -i '/razor_postinstall/d' /etc/crontab
9+
10+
curl -s <%= broker_install_url %> | bash
11+
if [ $? -ne 0 ]; then
12+
echo "Broker run failed; see /var/log/razor.log for more details" >> /tmp/razor_complete.log
13+
else
14+
echo Ran '<%= broker_install_url %>' >> /tmp/razor_complete.log
15+
fi
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
d-i console-setup/ask_detect boolean false
2+
d-i keyboard-configuration/layoutcode string us
3+
d-i netcfg/choose_interface select auto
4+
d-i netcfg/get_hostname string <%= node.metadata['hostname'] || node.hostname %>
5+
d-i netcfg/get_domain string <%= (node.metadata['hostname'] || node.hostname).split('.').drop(1).join('.') %>
6+
d-i netcfg/no_default_route boolean true
7+
# This is introduced in Trusty.
8+
d-i live-installer/net-image string <%= repo_url("install/filesystem.squashfs") %>
9+
d-i mirror/protocol string <%= repo_uri.scheme %>
10+
d-i mirror/country string manual
11+
d-i mirror/http/hostname string <%= "#{repo_uri.host}:#{repo_uri.port}" %>
12+
d-i mirror/http/directory string <%= repo_uri.path %>
13+
d-i clock-setup/utc boolean true
14+
d-i time/zone string <%= node.metadata['timezone'] || 'US/Pacific' %>
15+
d-i clock-setup/ntp boolean true
16+
d-i clock-setup/ntp-server string ntp.ubuntu.com
17+
d-i partman-auto/disk string /dev/sda
18+
d-i partman-auto/method string lvm
19+
d-i partman-lvm/device_remove_lvm boolean true
20+
d-i partman-md/device_remove_md boolean true
21+
d-i partman-auto-lvm/guided_size string max
22+
d-i partman-auto/choose_recipe select atomic
23+
d-i partman-auto/purge_lvm_from_device boolean true
24+
d-i partman/default_filesystem string ext4
25+
d-i partman-auto/init_automatically_partition select biggest_free
26+
d-i partman-lvm/confirm boolean true
27+
d-i partman-lvm/confirm_nooverwrite boolean true
28+
d-i partman-partitioning/confirm_write_new_label boolean true
29+
d-i partman/choose_partition select finish
30+
d-i partman/confirm boolean true
31+
d-i partman/confirm_nooverwrite boolean true
32+
d-i partman-md/confirm boolean true
33+
d-i passwd/root-login boolean true
34+
d-i passwd/make-user boolean true
35+
d-i passwd/root-password password <%= node.metadata['root_password'] || node.root_password %>
36+
d-i passwd/root-password-again password <%= node.metadata['root_password'] || node.root_password %>
37+
d-i passwd/user-fullname string Ubuntu User
38+
d-i passwd/username string ubuntu
39+
d-i passwd/user-password password insecure
40+
d-i passwd/user-password-again password insecure
41+
d-i user-setup/allow-password-weak boolean true
42+
d-i apt-setup/restricted boolean true
43+
d-i pkgsel/include string curl openssh-server
44+
d-i grub-installer/only_debian boolean true
45+
d-i grub-installer/with_other_os boolean true
46+
d-i finish-install/reboot_in_progress note
47+
# Uncomment this for `nomodeset`.
48+
# d-i debian-installer/add-kernel-opts string nomodeset
49+
# Our callbacks
50+
d-i preseed/early_command string wget <%= log_url("preseed start") %>
51+
d-i preseed/late_command string wget <%= log_url("preseed end") %>; \
52+
wget <%= file_url("os_boot") %> -O /target/usr/local/sbin/razor_postinstall.sh; \
53+
printf %b '@reboot root (sleep 90; /bin/bash /usr/local/sbin/razor_postinstall.sh)\n' >> /target/etc/crontab; \
54+
chmod +x /target/usr/local/sbin/razor_postinstall.sh; \
55+
wget <%= stage_done_url("preseed") %>
56+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<%# -*- shell-script -*- %>
2+
# Get current IP
3+
node_ip=$(ip addr show | grep -A 2 BROADCAST | grep inet | awk '{ print $2 }' | awk -F'/' '{print $1}')
4+
echo IP is $node_ip
5+
6+
# Send IP up
7+
curl -s <%= store_url("ip" => "$node_ip") %>
8+
9+
# Send final state
10+
curl -s <%= stage_done_url("store_ip") %>

0 commit comments

Comments
 (0)