Skip to content

Commit

Permalink
Add autoinstall support for Fedora Workstation (#612)
Browse files Browse the repository at this point in the history
Signed-off-by: linhuali <lli@vmware.com>
  • Loading branch information
linhuali authored Jul 18, 2024
1 parent 8120b24 commit 7f6a228
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ This project supports below scenarios for end-to-end guest operating system vali
| Windows 10, 11 | :heavy_check_mark: | | :heavy_check_mark: |
| Windows Server 2019, 2022 | :heavy_check_mark: | | :heavy_check_mark: |
| UnionTech OS Server 20 1050a | :heavy_check_mark: | | :heavy_check_mark: |
| Fedora Server 36 and later | :heavy_check_mark: | | :heavy_check_mark: |
| Fedora 39 Server, Workstation and later | :heavy_check_mark: | | :heavy_check_mark: |
| ProLinux Server 7.9, 8.5 | :heavy_check_mark: | | :heavy_check_mark: |
| FreeBSD 13 and later | :heavy_check_mark: | | :heavy_check_mark: |
| Pardus 21.2 Server,XFCE Desktop and later | :heavy_check_mark: | | :heavy_check_mark: |
Expand Down
File renamed without changes.
81 changes: 81 additions & 0 deletions autoinstall/Fedora/39/Workstation/ks.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Applicable to Fedora Workstation autoinstall with Fedora-Everything-netinst-.*.iso
# version=DEVEL
# Use graphical install
graphical
repo --name=fedora --metalink="https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch"
repo --name=updates --metalink="https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch"

# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'

# System language
lang en_US.UTF-8

# Use network installation
url --metalink="https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch"

%packages
@^workstation-product-environment
@base-x
open-vm-tools-desktop
%end

# License agreement
eula --agreed

# X Window System configuration information
xconfig --startxonboot
# Do not run the Setup Agent on first boot
firstboot --disable

# Generated using Blivet version 3.5.0
ignoredisk --only-use={{ boot_disk_name }}
autopart
# Partition clearing information
clearpart --none --initlabel

# System services
services --enabled="chronyd,sshd"

# System timezone
timezone America/New_York --utc

# Network
network --bootproto=dhcp --ipv6=auto --activate
network --hostname=localhost.localdomain

# Firewall configuration
firewall --disabled

#Root password
rootpw --iscrypted {{ vm_password_hash }}

# Add SSH key
sshkey --username=root "{{ ssh_public_key }}"

{% if new_user is defined and new_user != 'root' %}
user --name={{ new_user }} --password={{ vm_password_hash }} --groups=root,wheel --iscrypted --gecos="{{ new_user }}"
sshkey --username={{ new_user }} "{{ ssh_public_key }}"
{% endif %}

# Shutdown when the install is finished.
shutdown

%post --interpreter=/usr/bin/bash --log=/root/ks-post.log
if [ -f /etc/cloud/cloud.cfg ]; then
sed -i 's/^disable_root:.*/disable_root: false/' /etc/cloud/cloud.cfg
sed -i 's/^ssh_pwauth:.*/ssh_pwauth: yes/' /etc/cloud/cloud.cfg
fi

# Permit root login via SSH
sed -i 's/^#PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config

{% if new_user is defined and new_user != 'root' %}
# Add new user to sudoer
echo '{{ new_user }} ALL=(ALL) NOPASSWD:ALL' >/etc/sudoers.d/{{ new_user }}
# Enable autologin
sed -i '/\[daemon\]/a AutomaticLogin={{ new_user }}' /etc/gdm/custom.conf
sed -i '/\[daemon\]/a AutomaticLoginEnable=True' /etc/gdm/custom.conf
{% endif %}
echo '{{ autoinstall_complete_msg }}' >/dev/ttyS0
%end
2 changes: 1 addition & 1 deletion autoinstall/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
15. For Debian 10.1x, 11.x or later unattend auto-install, please use file Debian/10/preseed.cfg.
16. For UnionTech OS Server 20 1050a unattend auto-install, please use file UOS/Server/20/1050a/ks.cfg.
17. For UnionTech OS Server 20 1050e unattend auto-install, please use file UOS/Server/20/1050e/ks.cfg.
18. For Fedora Server 36 or later unattend auto-install, please use file Fedora/36/Server/ks.cfg.
18. For Fedora 39 Server and Workstation or later unattend auto-install, please use files under Fedora/39.
19. For FreeBSD 13 unattend auto-install, please use file FreeBSD/13/installerconfig.
20. For FreeBSD 14 or later unattend auto-install, please use file FreeBSD/14/installerconfig.
21. For Pardus 21.2 Server and XFCE Desktop or later unattend auto-install, please use file Pardus/preseed.cfg.
Expand Down
9 changes: 9 additions & 0 deletions linux/utils/get_os_edition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,12 @@
{%- else -%}Server
{%- endif -%}
when: guest_os_ansible_distribution is match("Pardus.*")

- name: "Get Fedora Edition"
ansible.builtin.set_fact:
guest_os_edition: |-
{%- if guest_os_release.VARIANT_ID is defined and guest_os_release.VARIANT_ID -%}{{ guest_os_release.VARIANT_ID | capitalize }}
{%- elif 'Workstation Edition' in guest_os_release -%}Workstation
{%- else -%}Server
{%- endif -%}
when: guest_os_ansible_distribution == "Fedora"

0 comments on commit 7f6a228

Please sign in to comment.