|
| 1 | +auth --enableshadow --passalgo=sha512 |
| 2 | +reboot |
| 3 | +url --url="mirror.centos.org/centos/7/os/x86_64" |
| 4 | +firewall --enabled --service=ssh |
| 5 | +firstboot --disable |
| 6 | +ignoredisk --only-use=vda |
| 7 | +keyboard --vckeymap=us --xlayouts='us' |
| 8 | +# System language |
| 9 | +lang en_US.UTF-8 |
| 10 | +repo --name "os" --baseurl="http://mirror.centos.org/centos/7/os/x86_64/" --cost=100 |
| 11 | +repo --name "updates" --baseurl="http://mirror.centos.org/centos/7/updates/x86_64/" --cost=100 |
| 12 | +repo --name "extras" --baseurl="http://mirror.centos.org/centos/7/extras/x86_64/" --cost=100 |
| 13 | + |
| 14 | +# oVirt specific repos |
| 15 | +repo --name "centos-ovirt43" --baseurl="http://mirror.centos.org/centos/7/virt/x86_64/ovirt-4.3/" --cost=100 |
| 16 | + |
| 17 | +# Network information |
| 18 | +network --bootproto=dhcp |
| 19 | +network --hostname=localhost.localdomain |
| 20 | +# Root password |
| 21 | +rootpw --iscrypted thereisnopasswordanditslocked |
| 22 | +selinux --enforcing |
| 23 | +services --disabled="kdump" --enabled="network,sshd,rsyslog,chronyd" |
| 24 | +timezone UTC --isUtc |
| 25 | +# Disk |
| 26 | +bootloader --append="console=tty0" --location=mbr --timeout=1 --boot-drive=vda |
| 27 | +zerombr |
| 28 | +clearpart --all --initlabel |
| 29 | +part / --fstype="xfs" --ondisk=vda --size=4096 --grow |
| 30 | + |
| 31 | +%post --erroronfail |
| 32 | +passwd -d root |
| 33 | +passwd -l root |
| 34 | +
|
| 35 | +# pvgrub support |
| 36 | +echo -n "Creating grub.conf for pvgrub" |
| 37 | +rootuuid=$( awk '$2=="/" { print $1 };' /etc/fstab ) |
| 38 | +mkdir /boot/grub |
| 39 | +echo -e 'default=0\ntimeout=0\n\n' > /boot/grub/grub.conf |
| 40 | +for kv in $( ls -1v /boot/vmlinuz* |grep -v rescue |sed s/.*vmlinuz-// ); do |
| 41 | + echo "title CentOS Linux 7 ($kv)" >> /boot/grub/grub.conf |
| 42 | + echo -e "\troot (hd0)" >> /boot/grub/grub.conf |
| 43 | + echo -e "\tkernel /boot/vmlinuz-$kv ro root=$rootuuid console=hvc0 LANG=en_US.UTF-8" >> /boot/grub/grub.conf |
| 44 | + echo -e "\tinitrd /boot/initramfs-$kv.img" >> /boot/grub/grub.conf |
| 45 | + echo |
| 46 | +done |
| 47 | +ln -sf grub.conf /boot/grub/menu.lst |
| 48 | +ln -sf /boot/grub/grub.conf /etc/grub.conf |
| 49 | +
|
| 50 | +# setup systemd to boot to the right runlevel |
| 51 | +rm -f /etc/systemd/system/default.target |
| 52 | +ln -s /lib/systemd/system/multi-user.target /etc/systemd/system/default.target |
| 53 | +echo . |
| 54 | +
|
| 55 | +yum -C -y remove linux-firmware |
| 56 | +
|
| 57 | +# Remove firewalld; it is required to be present for install/image building. |
| 58 | +# but we dont ship it in cloud |
| 59 | +yum -C -y remove firewalld --setopt="clean_requirements_on_remove=1" |
| 60 | +yum -C -y remove avahi\* Network\* |
| 61 | +sed -i '/^#NAutoVTs=.*/ a\ |
| 62 | +NAutoVTs=0' /etc/systemd/logind.conf |
| 63 | +
|
| 64 | +cat > /etc/sysconfig/network << EOF |
| 65 | +NETWORKING=yes |
| 66 | +NOZEROCONF=yes |
| 67 | +EOF |
| 68 | +
|
| 69 | +# For cloud images, 'eth0' _is_ the predictable device name, since |
| 70 | +# we don't want to be tied to specific virtual (!) hardware |
| 71 | +rm -f /etc/udev/rules.d/70* |
| 72 | +ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules |
| 73 | +
|
| 74 | +# simple eth0 config, again not hard-coded to the build hardware |
| 75 | +cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF |
| 76 | +DEVICE="eth0" |
| 77 | +BOOTPROTO="dhcp" |
| 78 | +ONBOOT="yes" |
| 79 | +TYPE="Ethernet" |
| 80 | +USERCTL="yes" |
| 81 | +PEERDNS="yes" |
| 82 | +IPV6INIT="no" |
| 83 | +PERSISTENT_DHCLIENT="1" |
| 84 | +EOF |
| 85 | +
|
| 86 | +echo "virtual-guest" > /etc/tuned/active_profile |
| 87 | +
|
| 88 | +# generic localhost names |
| 89 | +cat > /etc/hosts << EOF |
| 90 | +127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 |
| 91 | +::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 |
| 92 | +
|
| 93 | +EOF |
| 94 | +echo . |
| 95 | +
|
| 96 | +systemctl mask tmp.mount |
| 97 | +
|
| 98 | +cat <<EOL > /etc/sysconfig/kernel |
| 99 | +# UPDATEDEFAULT specifies if new-kernel-pkg should make |
| 100 | +# new kernels the default |
| 101 | +UPDATEDEFAULT=yes |
| 102 | +
|
| 103 | +# DEFAULTKERNEL specifies the default kernel package type |
| 104 | +DEFAULTKERNEL=kernel |
| 105 | +EOL |
| 106 | +
|
| 107 | +# make sure firstboot doesn't start |
| 108 | +echo "RUN_FIRSTBOOT=NO" > /etc/sysconfig/firstboot |
| 109 | +
|
| 110 | +yum clean all |
| 111 | +
|
| 112 | +# XXX instance type markers - MUST match CentOS Infra expectation |
| 113 | +echo 'ovirt' > /etc/yum/vars/infra |
| 114 | +
|
| 115 | +# chance dhcp client retry/timeouts to resolve #6866 |
| 116 | +cat >> /etc/dhcp/dhclient.conf << EOF |
| 117 | +
|
| 118 | +timeout 300; |
| 119 | +retry 60; |
| 120 | +EOF |
| 121 | +
|
| 122 | +echo "Fixing SELinux contexts." |
| 123 | +touch /var/log/cron |
| 124 | +touch /var/log/boot.log |
| 125 | +mkdir -p /var/cache/yum |
| 126 | +/usr/sbin/fixfiles -R -a restore |
| 127 | +
|
| 128 | +# reorder console entries |
| 129 | +sed -i 's/console=tty0/console=tty0 console=ttyS0,115200n8/' /boot/grub2/grub.cfg |
| 130 | +
|
| 131 | +%end |
| 132 | + |
| 133 | +%packages |
| 134 | +@core |
| 135 | +chrony |
| 136 | +cloud-init |
| 137 | +cloud-utils-growpart |
| 138 | +dracut-config-generic |
| 139 | +dracut-norescue |
| 140 | +firewalld |
| 141 | +grub2 |
| 142 | +kernel |
| 143 | +nfs-utils |
| 144 | +rsync |
| 145 | +tar |
| 146 | +yum-utils |
| 147 | +-NetworkManager |
| 148 | +-aic94xx-firmware |
| 149 | +-alsa-firmware |
| 150 | +-alsa-lib |
| 151 | +-alsa-tools-firmware |
| 152 | +-biosdevname |
| 153 | +-iprutils |
| 154 | +-ivtv-firmware |
| 155 | +-iwl100-firmware |
| 156 | +-iwl1000-firmware |
| 157 | +-iwl105-firmware |
| 158 | +-iwl135-firmware |
| 159 | +-iwl2000-firmware |
| 160 | +-iwl2030-firmware |
| 161 | +-iwl3160-firmware |
| 162 | +-iwl3945-firmware |
| 163 | +-iwl4965-firmware |
| 164 | +-iwl5000-firmware |
| 165 | +-iwl5150-firmware |
| 166 | +-iwl6000-firmware |
| 167 | +-iwl6000g2a-firmware |
| 168 | +-iwl6000g2b-firmware |
| 169 | +-iwl6050-firmware |
| 170 | +-iwl7260-firmware |
| 171 | +-libertas-sd8686-firmware |
| 172 | +-libertas-sd8787-firmware |
| 173 | +-libertas-usb8388-firmware |
| 174 | +-plymouth |
| 175 | + |
| 176 | +# oVirt specific packages |
| 177 | +ovirt-guest-agent-common |
| 178 | + |
| 179 | +%end |
| 180 | + |
0 commit comments