RHEL8 kickstart for Azure

たぶんこんな感じで、Azure MarketplaceにあるRHEL7.6と同じようなパッケージ構成になる(はず)。

#version=RHEL8
# Kickstart for provisioning a RHEL 8 Azure VM

repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream

# System authorization information
  auth --enableshadow --passalgo=sha512

# Use text install
text

# Do not run the Setup Agent on first boot
firstboot --disable

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

# System language
lang en_US.UTF-8

# Network information
network  --bootproto=dhcp

# Root password
rootpw --plaintext "to_be_disabled"

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

# System timezone
timezone Etc/UTC --isUtc --ntpservers 0.rhel.pool.ntp.org,1.rhel.pool.ntp.org,2.rhel.pool.ntp.org,3.rhel.pool.ntp.org

# Partition clearing information
clearpart --all --initlabel

# Clear the MBR
zerombr

# Disk partitioning information
part /boot --fstype="xfs" --size=500
part / --fstyp="xfs" --size=1 --grow --asprimary

# System bootloader configuration
bootloader --location=mbr

# Firewall configuration
firewall --disabled

# Enable SELinux
selinux --enforcing

# Don't configure X
skipx

# Power down the machine after install
poweroff

%packages
@^minimal-environment
chrony
sudo
parted
WALinuxAgent
abrt
abrt-addon-ccpp
abrt-addon-kerneloops
abrt-addon-pstoreoops
abrt-addon-vmcore
abrt-addon-xorg
abrt-cli
abrt-console-notification
abrt-dbus
abrt-libs
abrt-tui
alsa-firmware
alsa-lib
alsa-tools-firmware
at
attr
augeas-libs
bash-completion
bc
binutils
blktrace
boost-date-time
boost-system
boost-thread
bpftool
bzip2
crda
cryptsetup
curl
cyrus-sasl-plain
desktop-file-utils
device-mapper-event
device-mapper-event-libs
device-mapper-persistent-data
dosfstools
dyninst
ed
elfutils
emacs-filesystem
fprintd
fprintd-pam
fxload
gdb
hunspell
hunspell-en
hunspell-en-GB
hunspell-en-US
iw
iwl6000g2b-firmware
kmod-kvdo
kpatch
langtable
langtable-data
ledmon
libaio
libcgroup
libconfig
libdrm
libdwarf
libfprint
libgudev
libicu
libidn
libmodman
libpciaccess
libproxy
libreport
libreport-cli
libreport-plugin-mailx
libreport-plugin-rhtsupport
libreport-plugin-ureport
libreport-rhel
libreport-web
libssh2
libstoragemgmt
libtar
libxml2
libxslt
lm_sensors-libs
lsof
lvm2
lvm2-libs
lz4
mailx
make
man-pages
man-pages-overrides
mdadm
mlocate
mtr
nano
nspr
nss
nss-softokn
nss-softokn-freebl
nss-sysinit
nss-tools
nss-util
ntsysv
pciutils
perl
perl-Carp
perl-Encode
perl-Exporter
perl-File-Path
perl-File-Temp
perl-Filter
perl-Getopt-Long
perl-HTTP-Tiny
perl-PathTools
perl-Pod-Escapes
perl-Pod-Perldoc
perl-Pod-Simple
perl-Pod-Usage
perl-Scalar-List-Utils
perl-Socket
perl-Storable
perl-Text-ParseWords
perl-Time-HiRes
perl-Time-Local
perl-constant
perl-libs
perl-macros
perl-parent
perl-podlators
perl-threads
perl-threads-shared
pinfo
pixman
psacct
python3-pyOpenSSL
pygobject2
python3-pygpgme
python3-augeas
python2-backports
python2-backports-ssl_match_hostname
python3-chardet
python3-hwdata
python2-ipaddress
python3-lxml
python3-magic
python3-pycurl
python3-pyyaml
qemu-guest-agent
qrencode-libs
quota
quota-nls
redhat-indexhtml
redhat-logos
redhat-release
rhn-check
rhn-client-tools
rhn-setup
rhnlib
rhnsd
rng-tools
rpcbind
rsync
satyr
scl-utils
setserial
sgpio
smartmontools
sos
sqlite
strace
subscription-manager-plugin-container
subscription-manager-rhsm-certificates
sysstat
systemtap-runtime
tar
tcpdump
tcsh
time
traceroute
unzip
usb_modeswitch
usb_modeswitch-data
usbutils
vdo
vim-common
vim-enhanced
vim-filesystem
wget
words
wpa_supplicant
xdg-utils
xfsdump
xmlrpc-c
xmlrpc-c-client
yajl
zip
-dracut-config-rescue

%end

%addon com_redhat_kdump --disable --reserve-mb='auto'

%end

%post --log=/var/log/anaconda/post-install.log

#!/bin/bash

# Enable waagent at boot-up
systemctl enable waagent

# Disable the root account
usermod root -p '!!'

# Install Hyper-V device drivers
cat << EOF > /etc/dracut.conf.d/dracut.conf
add_drivers+=" hv_vmbus "
add_drivers+=" hv_netvsc "
add_drivers+=" hv_storvsc "
EOF
dracut -f -v --regenerate-all

# Configure root password deletion in WALinuxAgent
sed -i 's/^\(Provisioning\.DeleteRootPassword\)=[Yy]$/\1=n/g' /etc/waagent.conf

# Configure swap in WALinuxAgent
sed -i 's/^\(ResourceDisk\.EnableSwap\)=[Nn]$/\1=y/g' /etc/waagent.conf
sed -i 's/^\(ResourceDisk\.SwapSizeMB\)=[0-9]*$/\1=2048/g' /etc/waagent.conf

# Set the GRUB cmdline
sed -i 's/^\(GRUB_CMDLINE_LINUX\)=".*"$/\1="console=tty1 console=ttyS0 earlyprintk=ttyS0 rootdelay=300"/g' /etc/default/grub

# Build the grub cfg
grub2-mkconfig -o /boot/grub2/grub.cfg

# Configure network
cat << EOF > /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
ONBOOT="yes"
BOOTPROTO="dhcp"
TYPE="Ethernet"
USERCTL="yes"
PEERDNS="yes"
IPV6INIT="no"
EOF

# Enable SSH keepalive & password authentication
sed -i 's/^#\(ClientAliveInterval\).*$/\1 180/g' /etc/ssh/sshd_config
sed -i 's/^#\(PasswordAuthentication\).*$/\1 yes/g' /etc/ssh/sshd_config

# Set a generic hostname
hostnamectl set-hostname localhost.localdomain

# Deprovision and prepare for Azure
waagent -force -deprovision

%end
タイトルとURLをコピーしました