Created
May 2, 2017 19:45
-
-
Save schlomo/b532ba9bca87ea40d922d90e62b7338c to your computer and use it in GitHub Desktop.
Vagrantfile to show the autorelabel bug with centos/7 Vagrant images. See https://github.com/rear/rear-workshop-osbconf-2016/issues/4 and https://bugs.centos.org/view.php?id=13213
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BUG proof for VirtualBox vagrant with centos/7 failing to run autorelabel | |
# | |
# before starting install the reload plugin with: vagrant plugin install vagrant-reload | |
# | |
# see the bug: vagrant up | |
# destroy VM: vagrant destroy -f | |
# see the fix (disable serial console): FIX=1 vagrant up | |
# | |
# destroy VM: vagrant destroy -f | |
Vagrant.configure(2) do |config| | |
config.vm.box = "centos/7" | |
config.vm.provider "virtualbox" do |vb| | |
vb.memory = "1024" | |
end | |
config.vm.synced_folder ".", "/vagrant", disabled: true | |
if ENV['FIX'] | |
config.vm.provision "shell", inline: <<-SHELL | |
set -x | |
sed -i -e 's/ console=[^ ]\\+\\?//g' /etc/default/grub | |
cat /etc/default/grub | |
grub2-mkconfig -o /boot/grub2/grub.cfg | |
SHELL | |
end | |
config.vm.provision "shell", inline: <<-SHELL | |
set -x | |
touch /.autorelabel | |
SHELL | |
config.vm.provision :reload | |
config.vm.provision "shell", inline: <<-SHELL | |
set -x | |
ls -l /.autorelabel || : "************ AUTORELABELING DONE ***************" | |
systemctl status rhel-autorelabel | |
grep ttyS0 /proc/cmdline /etc/default/grub /boot/grub2/grub.cfg || : "************ EVERYTING IS FINE NOW ***************" | |
SHELL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment