Hi Folks,

I'm having problems provisioning 3 x CenOS 7 boxes and wondered if anyone 
might be able to point out where I'm going wrong?

Vagrant version 

Vagrant 2.0.0


Host operating system 

MacOS High Sierra


Guest operating system 

CentOS 7.


Vagrantfile

# -*- mode: ruby -*-# vi: set ft=ruby :
# Project initialised with: vagrant init centos/7 --box-version 1804.02# 
Provider added with: vagrant plugin install vagrant-vmware-fusion# License 
added with: vagrant plugin license vagrant-vmware-fusion 
/Users/$USER/vagrant/license.lic# NB: A license will need to be purchased from 
Hashicorp before the command above will work.# Boxes brought up with: vagrant up
Vagrant.configure("2") do |config|

  # Base box config.
  config.vm.box = "centos/7"
  config.vm.box_version = "1804.02"
  
  config.vm.provision "shell", inline: "Provisioning Master server."
  config.vm.define "master" do |master|
    # Set network properties.
    master.vm.network "public_network", bridge: 'en0',
      use_dhcp_assigned_default_route: true
    master.vm.network "private_network", type: "dhcp"
    # config.vm.network "forwarded_port", guest: 80, host: 8080
    # Enable provisioning with a shell script.
    master.vm.provision :shell, path: "master_bootstrap.sh"
  end

  config.vm.provision "shell", inline: "Provisioning GUI server."
  config.vm.define "gui" do |gui|
    # Set network properties.
    gui.vm.network "private_network", type: "dhcp"
    # config.vm.network "public_network",
    #    use_dhcp_assigned_default_route: true
    # Enable provisioning with a shell script.
    gui.vm.provision :shell, path: "gui_bootstrap.sh"
  end
  
  config.vm.provision "shell", inline: "Provisioning CLI server."
  config.vm.define "cli" do |cli|
    # Set network properties.
    cli.vm.network "private_network", type: "dhcp"
    # config.vm.network "public_network",
    #    use_dhcp_assigned_default_route: true
    # Enable provisioning with a shell script.
    cli.vm.provision :shell, path: "cli_bootstrap.sh"
  end

  # config.vm.network "public_network"

  # Provider-specific configuration
  config.vm.provider "vmware_fusion" do |v|
    # Display the VMWare GUI when booting the machine
    v.gui = true
  
    # Customize the amount of memory on the VM:
    v.memory = "2048"
    
    # Whitelist
    v.whitelist_verified = true
  end

  # Enable provisioning with a shell script.
  config.vm.provision :shell, path: "bootstrap.sh"end

Expected behavior

Vagrant boxes should have been provisioned by the inline shell scripts.


Actual behavior

The following error occurs when I run vagrant up. I think it may be some 
issue reading the bootstrap files:


Tue Aug 21 - 00:32:14 :~/vagrant/centos_el7 $ vagrant up
Bringing machine 'master' up with 'vmware_fusion' provider...
Bringing machine 'gui' up with 'vmware_fusion' provider...
Bringing machine 'cli' up with 'vmware_fusion' provider...
==> master: Cloning VMware VM: 'centos/7'. This can take some time...
==> master: Checking if box 'centos/7' is up to date...
==> master: Verifying vmnet devices are healthy...
==> master: Preparing network adapters...
==> master: Starting the VMware VM...
==> master: Waiting for the VM to receive an address...
==> master: Forwarding ports...
    master: -- 22 => 2222
==> master: Waiting for machine to boot. This may take a few minutes...
    master: SSH address: 127.0.0.1:2222
    master: SSH username: vagrant
    master: SSH auth method: private key
    master: Warning: Remote connection disconnect. Retrying...
    master: Warning: Connection reset. Retrying...
    master: Warning: Remote connection disconnect. Retrying...
    master: 
    master: Vagrant insecure key detected. Vagrant will automatically replace
    master: this with a newly generated keypair for better security.
    master: 
    master: Inserting generated public key within guest...
    master: Removing insecure key from the guest if it's present...
    master: Key inserted! Disconnecting and reconnecting using new SSH key...
==> master: Machine booted and ready!
==> master: Configuring network adapters within the VM...
    master: SSH address: 127.0.0.1:2222
    master: SSH username: vagrant
    master: SSH auth method: private key
==> master: Rsyncing folder: /Users/user1/vagrant/centos_el7/ => /vagrant
==> master: Running provisioner: shell...
    master: Running: inline script
==> master: /tmp/vagrant-shell: line 1: Provisioning: command not found
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.
 

Steps to reproduce 
   
   1. vagrant destroy
   2. y
   3. vagrant up

Associated files:

bootstrap.sh


#!/usr/bin/bash

sudo yum -y update
sudo yum -y install yum-utils
sudo yum install -y epel-release
 

master_bootstrap.sh


#!/usr/bin/bash

# Install dev tools and env.
sudo yum -y groupinstall development
sudo yum install -y gcc openssl-devel bzip2-devel wget
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz
tar xzf Python-3.7.0.tgz
cd Python-3.7.0
./configure --enable-optimizations
make altinstall
sudo yum install -y python36-setuptools
sudo easy_install-3.6 pip

# Install PXE boot server components.
sudo yum install -y dhcp tftp tftp-server syslinux vsftpd

# Set system name.
sudo hostnamectl set-hostname master
sudo hostname master

# Install web server
sudo yum install -y nginx
sudo systemctl enable nginx
sudo systemctl start nginx
#sudo firewall-cmd --permanent --zone=public --add-service=http 
#sudo firewall-cmd --permanent --zone=public --add-service=https
#sudo firewall-cmd --reload
 

gui_bootstrap.sh


#!/usr/bin/bash

# Set hostname.
sudo hostnamectl set-hostname server1
sudo hostname server1

# Install graphical utils, development and other tools.
sudo yum install -y redhat-lsb-core net-tools kernel-headers kernel-devel
sudo yum -y groupinstall "Development Tools"
sudo yum -y groupinstall "X Window System" "MATE Desktop"

# Configure GUI.
sudo systemctl set-default graphical.target
sudo systemctl isolate graphical.target

# Install VMWare tools.
sudo yum install -y open-vm-tools

# Create user
sudo adduser vadmin
sudo usermod -aG wheel vadmin
# sudo passwd vadmin
 

cli_bootstrap.sh


#!/usr/bin/bash

sudo hostnamectl set-hostname server2
sudo hostname server2

Any assistance welcome.

 

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/2ed969f0-fc7d-4c3b-a947-6d66fbb7df6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to