Skip to content

Commit

Permalink
[Linux] Shutdown guest OS after auto install completes instead of reb…
Browse files Browse the repository at this point in the history
…ooting (#489)

Signed-off-by: Qi Zhang <qiz@vmware.com>
  • Loading branch information
keirazhang authored Aug 14, 2023
1 parent fa609ea commit e03f031
Show file tree
Hide file tree
Showing 27 changed files with 181 additions and 170 deletions.
4 changes: 2 additions & 2 deletions autoinstall/BCLinux-for-Euler/21.10/ks.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ services --disabled="firewalld"
# System timezone
timezone America/New_York --isUtc

# Reboot when the install is finished.
reboot
# Shutdown when the install is finished.
shutdown

%packages
@^graphical-server-environment
Expand Down
4 changes: 2 additions & 2 deletions autoinstall/BCLinux/8/ks.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ services --disabled="firewalld"
# System timezone
timezone America/New_York --isUtc

# Reboot when the install is finished.
reboot
# Shutdown when the install is finished.
shutdown

%packages
@^graphical-server-environment
Expand Down
4 changes: 2 additions & 2 deletions autoinstall/CentOS/7/ks.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ clearpart --none --initlabel
services --disabled=firewalld
eula --agreed

# Reboot when installation finished
reboot
# Shutdown when installation finished
shutdown

%packages
@^graphical-server-environment
Expand Down
4 changes: 2 additions & 2 deletions autoinstall/CentOS/7/minimal/ks.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ clearpart --none --initlabel
services --disabled=firewalld
eula --agreed

# Reboot when installation finished
reboot
# Shutdown when installation finished
shutdown

%packages
@^minimal
Expand Down
3 changes: 3 additions & 0 deletions autoinstall/Debian/10/preseed.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ d-i grub-installer/bootdev string default
# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note

# Shutdown after installation completes
d-i debian-installer/exit/poweroff boolean true

# This will prevent the installer from ejecting the CD during the reboot,
# which is useful in some situations.
#d-i cdrom-detect/eject boolean false
Expand Down
4 changes: 2 additions & 2 deletions autoinstall/Fedora/36/Server/ks.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ user --name={{ new_user }} --password={{ vm_password_hash }} --groups=root,wheel
sshkey --username={{ new_user }} "{{ ssh_public_key }}"
{% endif %}

# Reboot when the install is finished.
reboot
# Shutdown when the install is finished.
shutdown

%post --interpreter=/usr/bin/bash --log=/root/ks-post.log
if [ -f /etc/cloud/cloud.cfg ]; then
Expand Down
4 changes: 3 additions & 1 deletion autoinstall/FreeBSD/installerconfig
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,6 @@ echo 'autoboot_delay="3"' >> /boot/loader.conf

echo "End of installerconfig" > /dev/ttyu0
echo "{{ autoinstall_complete_msg }}" > /dev/ttyu0
shutdown -r now

# Power off system when autoinstall completes
poweroff
3 changes: 3 additions & 0 deletions autoinstall/Pardus/preseed.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ d-i grub-installer/bootdev string default
# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note

# Shutdown after installation completes
d-i debian-installer/exit/poweroff boolean true

# This will prevent the installer from ejecting the CD during the reboot,
# which is useful in some situations.
#d-i cdrom-detect/eject boolean true
Expand Down
4 changes: 2 additions & 2 deletions autoinstall/RHEL/7/server_with_GUI/ks.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ clearpart --none --initlabel
services --disabled=firewalld
eula --agreed

# Reboot when the install is finished.
reboot
# Shutdown when the install is finished.
shutdown


%packages
Expand Down
4 changes: 2 additions & 2 deletions autoinstall/RHEL/7/server_without_GUI/ks.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ clearpart --none --initlabel
services --disabled=firewalld
eula --agreed

# Reboot when the install is finished.
reboot
# Shutdown when the install is finished.
shutdown

%packages
@^infrastructure-server-environment
Expand Down
4 changes: 2 additions & 2 deletions autoinstall/RHEL/8/server_with_GUI/ks.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ services --disabled="firewalld"
# System timezone
timezone America/New_York --isUtc

# Reboot when the install is finished.
reboot
# Shutdown when the install is finished.
shutdown

%packages
@^graphical-server-environment
Expand Down
4 changes: 2 additions & 2 deletions autoinstall/RHEL/8/server_without_GUI/ks.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ services --enabled="chronyd"
# System timezone
timezone America/New_York --isUtc

# Reboot when the install is finished.
reboot
# Shutdown when the install is finished.
shutdown
%packages
@^server-product-environment
kexec-tools
Expand Down
1 change: 1 addition & 0 deletions autoinstall/SLE/15/SP3/SLED/autoinst.xml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@
<general t="map">
<mode t="map">
<confirm t="boolean">false</confirm>
<final_halt config:type="boolean">true</final_halt>
</mode>
</general>
<groups t="list">
Expand Down
1 change: 1 addition & 0 deletions autoinstall/SLE/15/SP3/SLES/autoinst.xml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
<ask-list t="list"/>
<mode t="map">
<confirm t="boolean">false</confirm>
<final_halt config:type="boolean">true</final_halt>
</mode>
<proposals t="list"/>
<signature-handling t="map"/>
Expand Down
1 change: 1 addition & 0 deletions autoinstall/SLE/15/SP3/SLES_Minimal/autoinst.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<ask-list t="list"/>
<mode t="map">
<confirm t="boolean">false</confirm>
<final_halt config:type="boolean">true</final_halt>
</mode>
<proposals t="list"/>
<signature-handling t="map"/>
Expand Down
1 change: 1 addition & 0 deletions autoinstall/SLE/15/SP4/SLED/autoinst.xml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@
<general t="map">
<mode t="map">
<confirm t="boolean">false</confirm>
<final_halt config:type="boolean">true</final_halt>
</mode>
</general>
<groups t="list">
Expand Down
4 changes: 2 additions & 2 deletions autoinstall/UOS/Server/20/1050a/ks.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ services --enabled="chronyd"
# System timezone
timezone America/New_York --utc

# Reboot when the install is finished.
reboot
# Shutdown when the install is finished.
shutdown

%packages
@Server with DDE
Expand Down
4 changes: 2 additions & 2 deletions autoinstall/UOS/Server/20/1050e/ks.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ services --enabled="chronyd"
# System timezone
timezone America/New_York --isUtc

# Reboot when the install is finished.
reboot
# Shutdown when the install is finished.
shutdown

%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
Expand Down
2 changes: 1 addition & 1 deletion autoinstall/Ubuntu/Desktop/Subiquity/user-data.j2
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ autoinstall:
- sed -i 's/^#PermitRootLogin .*/PermitRootLogin yes/' /target/etc/ssh/sshd_config
- sed -i 's/^#PasswordAuthentication .*/PasswordAuthentication yes/' /target/etc/ssh/sshd_config
- echo "{{ autoinstall_complete_msg }}" >> /dev/ttyS0
shutdown: 'reboot'
shutdown: 'poweroff'
6 changes: 3 additions & 3 deletions autoinstall/Ubuntu/Desktop/Ubiquity/ubuntu.seed
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ d-i passwd/root-password-crypted password {{ vm_password_md5 }}
d-i user-setup/allow-password-weak boolean true

d-i pkgsel/language-packs multiselect en, zh
d-i pkgsel/update-policy select none
d-i pkgsel/update-policy select none
d-i pkgsel/upgrade select none

# By default, the system's locate database will be updated after the
Expand Down Expand Up @@ -75,10 +75,10 @@ ubiquity ubiquity/success_command \
in-target chmod 0644 /root/.ssh/authorized_keys; \
in-target sed -i 's/#PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config; \
in-target sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config; \
echo "{{ autoinstall_complete_msg }}" > /target/dev/ttyS0
echo "{{ autoinstall_complete_msg }}" >/dev/ttyS0

d-i finish-install/reboot_in_progress note
d-i cdrom-detect/eject boolean true

ubiquity ubiquity/summary note
ubiquity ubiquity/reboot boolean true
ubiquity ubiquity/poweroff boolean true
2 changes: 2 additions & 0 deletions autoinstall/Ubuntu/Server/user-data.j2
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@ autoinstall:
- echo 'Acquire::ForceIPv4 "true";' >>/etc/apt/apt.conf.d/99force-ipv4
- sed -i 's/^#PermitRootLogin .*/PermitRootLogin yes/' /target/etc/ssh/sshd_config
- sed -i 's/^#PasswordAuthentication .*/PasswordAuthentication yes/' /target/etc/ssh/sshd_config
- echo "{{ autoinstall_complete_msg }}" >/dev/ttyS0
shutdown: 'poweroff'
3 changes: 2 additions & 1 deletion autoinstall/openSUSE/15/autoinst.xml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@
<general t="map">
<mode t="map">
<confirm t="boolean">false</confirm>
<final_halt config:type="boolean">true</final_halt>
</mode>
</general>
<groups t="list">
Expand Down Expand Up @@ -1416,4 +1417,4 @@
</script>
</post-scripts>
</scripts>
</profile>
</profile>
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
# Copyright 2021-2023 VMware, Inc.
# Copyright 2023 VMware, Inc.
# SPDX-License-Identifier: BSD-2-Clause
---
# Eject CDROM of unattend install ISO in guest OS
- include_tasks: ../utils/eject_cdrom_in_guest.yml
vars:
guest_cdrom_device_num: "{{ os_install_iso_list_len | int -1 }}"
when: guest_os_family != "FreeBSD"

- name: "Eject CD for FreeBSD"
ansible.builtin.command: "camcontrol eject /dev/cd0"
delegate_to: "{{ vm_guest_ip }}"
when: guest_os_family == "FreeBSD"

# Delete unattend install ISO file
#
# By default, it's attached to the last CDROM in composed VM CDROMs list
- name: "Set fact of the controller and unit number of CDROM attaching unattend install ISO"
ansible.builtin.set_fact:
Expand Down
Loading

0 comments on commit e03f031

Please sign in to comment.