#version=DEVEL # Install OS instead of upgrade install # Keyboard layouts keyboard 'us' # Root password rootpw --plaintext vagrant # Use network installation url --url="http://mirror.centos.org/centos/7/os/x86_64/" # System language lang en_US.UTF-8 user --name=vagrant --password=vagrant repo --name="koji-override-0" --baseurl=http://mirror.centos.org/centos/7/extras/x86_64/ repo --name="koji-override-1" --baseurl=http://mirror.centos.org/centos/7/updates/x86_64/ # System authorization information auth --enableshadow --enablemd5 # Use text mode install text # SELinux configuration selinux --enforcing # Do not configure the X Window System skipx # Firewall configuration firewall --disabled # Network information network --bootproto=dhcp --device=eth0 # Reboot after installation reboot # System timezone timezone UTC --isUtc # System bootloader configuration bootloader --append="no_timer_check console=tty0 console=ttyS0,115200n8 net.ifnames=0 biosdevname=0 elevator=noop" --location=mbr --timeout=1 # Clear the Master Boot Record zerombr # Partition clearing information clearpart --all --drives=vda # Disk partitioning information part / --asprimary --fstype="xfs" --grow --ondisk=vda --size=1024 %post # configure swap to a file (fallocate doesn't work with c7 xfs) dd if=/dev/zero of=/swapfile bs=1M count=2048 chmod 600 /swapfile mkswap /swapfile echo "/swapfile none swap defaults 0 0" >> /etc/fstab # sudo echo "%vagrant ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/vagrant chmod 0440 /etc/sudoers.d/vagrant # Fix for https://github.com/CentOS/sig-cloud-instance-build/issues/38 cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF DEVICE="eth0" BOOTPROTO="dhcp" ONBOOT="yes" TYPE="Ethernet" PERSISTENT_DHCLIENT="yes" EOF # sshd: disable password authentication and DNS checks ex -s /etc/ssh/sshd_config <>/etc/sysconfig/sshd <> /home/vagrant/.ssh/authorized_keys chmod 600 /home/vagrant/.ssh/authorized_keys chown -R vagrant:vagrant /home/vagrant/.ssh # Fix for issue #76, regular users can gain admin privileges via su ex -s /etc/pam.d/su <<'EOF' # allow vagrant to use su, but prevent others from becoming root or vagrant /^account\s\+sufficient\s\+pam_succeed_if.so uid = 0 use_uid quiet$/ :append account [success=1 default=ignore] \\ pam_succeed_if.so user = vagrant use_uid quiet account required pam_succeed_if.so user notin root:vagrant . :update :quit EOF # systemd should generate a new machine id during the first boot, to # avoid having multiple Vagrant instances with the same id in the local # network. /etc/machine-id should be empty, but it must exist to prevent # boot errors (e.g. systemd-journald failing to start). :>/etc/machine-id echo 'vag' > /etc/yum/vars/infra # Blacklist the floppy module to avoid probing timeouts echo blacklist floppy > /etc/modprobe.d/nofloppy.conf chcon -u system_u -r object_r -t modules_conf_t /etc/modprobe.d/nofloppy.conf # Customize the initramfs pushd /etc/dracut.conf.d # There's no floppy controller, but probing for it generates timeouts echo 'omit_drivers+=" floppy "' > nofloppy.conf popd # Fix the SELinux context of the new files restorecon -f - <