How to setup ansible_local with vagrant 1.7.4? - vagrant

I have this configuration of my host machine:
hedin#home:~/123$ lsb_release -rcd
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty
hedin#home:~/123$ vagrant -v
Vagrant 1.7.2
I'm trying to deploy my guest with ansible_local provision. This is my Vagrant file:
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
# Run Ansible from the Vagrant VM
config.vm.provision "ansible_local" do |ansible|
ansible.playbook = "playbook.yml"
end
end
When I try to deploy it I receiving this output:
hedin#home:~/123$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:
vm:
* The '' provisioner could not be found.
How can I fix this?

Vagrant v1.7 versions have a bug causing this:
$ sudo dpkg -i ./vagrant_1.7.4_x86_64.deb
(Reading database ... 57030 files and directories currently installed.)
Preparing to unpack ./vagrant_1.7.4_x86_64.deb ...
Unpacking vagrant (1:1.7.4) over (1:1.7.3) ...
Setting up vagrant (1:1.7.4) ...
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:
vm:
* The 'ansible_local' provisioner could not be found.
Upgrade to the current version 1.8.5 (or at least 1.8.0):
$ sudo dpkg -i vagrant_1.8.0_x86_64.deb
(Reading database ... 57030 files and directories currently installed.)
Preparing to unpack vagrant_1.8.0_x86_64.deb ...
Unpacking vagrant (1:1.8.0) over (1:1.7.4) ...
Setting up vagrant (1:1.8.0) ...
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty64' is up to date...

Related

How do I get Vagrant to find the latest (homestead) box

I have the latest version of vagrant, I added a homestead box via vagrant box add laravel/homestead, I checked out the latest homestead from github via
git clone https://github.com/laravel/homestead.git homestead
cd homestead
git checkout release
but when I do vagrant up it cannot find the v10.1.1 box and tries to download v9.7.2 instead.
>vagrant -v
Vagrant 2.2.14
>vagrant box update
==> homestead: Checking for updates to 'laravel/homestead'
homestead: Latest installed version: 10.1.1
homestead: Version constraints: ~> 9
homestead: Provider: virtualbox
==> homestead: Box 'laravel/homestead' (v10.1.1) is running the latest version.
>vagrant box list
laravel/homestead (virtualbox, 10.1.1)
>vagrant up
Bringing machine 'homestead' up with 'virtualbox' provider...
==> homestead: [vagrant-hostsupdater] Checking for host entries
==> homestead: [vagrant-hostsupdater] found entry for: 192.168.10.10 homestead
==> homestead: [vagrant-hostsupdater] found entry for: 192.168.10.10 laravel.test
==> homestead: Box 'laravel/homestead' could not be found. Attempting to find and install...
homestead: Box Provider: virtualbox
homestead: Box Version: ~> 9
==> homestead: Loading metadata for box 'laravel/homestead'
homestead: URL: https://vagrantcloud.com/laravel/homestead
==> homestead: Adding box 'laravel/homestead' (v9.7.2) for provider: virtualbox
homestead: Downloading: https://vagrantcloud.com/laravel/boxes/homestead/versions/9.7.2/providers/virtualbox.box
==> homestead: Box download is resuming from prior download progress
I see that I can use version: 10.1.1 in my Homestead.yaml but why is vagrant trying to get v9 instead of using v10 I have?
The default setting in the laravel/homstead project is using the version 9.
So you have to modify the following setting in /Users/(name)/Homestead/scripts/homestead.rb
config.vm.box_version = settings['version'] ||= '‍‍‍‍‍~> 9'
to
config.vm.box_version = settings['version'] ||= '‍‍‍‍‍>= 10.1.1'
After saving the changes, you can start the box with:
vagrant up

Vagrant up causes guest additions to reinstall each time, why?

Ive had to move onto a new laptop running windows 10, so I have installed the latest Virtual box (6) and vagrant (2.2.6). I pulled down my project and ran a vagrant up to build the box and deploy all my work, but there was an issue with guest additions. The box is Centos 7, so after first launch, I carried out a yum update on the box and added vagrant plugins vbguest and hostsupdater to my local vagrant install. I also had to install deltarpms to get the update to work.
However each time I now up or reload the box, it says there is an issue with vbguest tools missing. IT then proceeeds to uninstall the VGA, reinstall the same version and then tell me it hasnt installed properly. However shared folders do appear to work. Any ideas what I can do to fix this on upload, full output below.
PS C:\Users\Paul M\projects\centos-docker> vagrant reload
==> default: [vagrant-hostsupdater] Removing hosts
==> default: Attempting graceful shutdown of VM...
==> default: Checking if box 'bento/centos-7.4' version '201709.15.0' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 8898 (guest) => 8898 (host) (adapter 1)
default: 8899 (guest) => 8899 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
==> default: Machine booted and ready!
[default] A Virtualbox Guest Additions installation was found but no tools to rebuild or start them.
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.vorboss.net
* extras: www.mirrorservice.org
* updates: www.mirrorservice.org
Package kernel-devel-3.10.0-1062.7.1.el7.x86_64 already installed and latest version
Package kernel-devel-3.10.0-1062.7.1.el7.x86_64 already installed and latest version
Package gcc-4.8.5-39.el7.x86_64 already installed and latest version
Package binutils-2.27-41.base.el7_7.1.x86_64 already installed and latest version
Package 1:make-3.82-24.el7.x86_64 already installed and latest version
Package 4:perl-5.16.3-294.el7_6.x86_64 already installed and latest version
Package bzip2-1.0.6-13.el7.x86_64 already installed and latest version
Package elfutils-libelf-devel-0.176-2.el7.x86_64 already installed and latest version
Nothing to do
Copy iso file C:\Program Files\Oracle\VirtualBox/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
Mounting Virtualbox Guest Additions ISO to: /mnt
mount: /dev/loop0 is write-protected, mounting read-only
Installing Virtualbox Guest Additions 6.0.14 - guest version is 6.0.14
Verifying archive integrity... All good.
Uncompressing VirtualBox 6.0.14 Guest Additions for Linux........
VirtualBox Guest Additions installer
Removing installed version 6.0.14 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel
modules. This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel
3.10.0-1062.7.1.el7.x86_64.
VirtualBox Guest Additions: Running kernel modules will not be replaced until
the system is restarted
An error occurred during installation of VirtualBox Guest Additions 6.0.14. Some functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
Redirecting to /bin/systemctl start vboxadd.service
Redirecting to /bin/systemctl start vboxadd-service.service
Unmounting Virtualbox Guest Additions ISO from: /mnt
==> default: Checking for guest additions in VM...
==> default: [vagrant-hostsupdater] Checking for host entries
==> default: Mounting shared folders...
default: /vagrant => C:/Users/Paul M/Projects/centos-docker
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
PS C:\Users\Paul M\projects\centos-docker>
My colleague is experiencing the exact same issue. It seems to be caused by the latest version of the vagrant plugin v0.22.0. The previous version, v0.21.0 did not have this issue.
Fetching: vagrant-vbguest-0.22.0.gem (100%)
Successfully uninstalled vagrant-vbguest-0.21.0
Updated 'vagrant-vbguest' to version '0.22.0'!
As soon as I updated the plugin, the vbguest additions were reinstalled.
--
Update:
Opened an issue: https://github.com/dotless-de/vagrant-vbguest/issues/362
--
Update: Workaround - Install 0.21
vagrant plugin uninstall vagrant-vbguest
Uninstalling the 'vagrant-vbguest' plugin...
Successfully uninstalled micromachine-3.0.0
Successfully uninstalled vagrant-vbguest-0.22.0
vagrant plugin install vagrant-vbguest --plugin-version 0.21
Installing the 'vagrant-vbguest --version '0.21'' plugin. This can take a few minutes...
Fetching: micromachine-3.0.0.gem (100%)
Fetching: vagrant-vbguest-0.21.0.gem (100%)
Installed the plugin 'vagrant-vbguest (0.21.0)'!
Update: Developer released an update
- .22.1 : vagrant plugin update should give you v.22.1
You can add this to the Vagrantfile to avoid the updating of guest additions if the user has the plugin installed (any version).
Vagrant.configure("2") do |config|
....
if Vagrant.has_plugin?("vagrant-vbguest")
config.vbguest.auto_update = false
end
....
end

Vagrant box could not be found or could not be accessed in the remote catalog - incompatible curl version

I just downloaded Vagrant and did the settings as well as install virtual box. I just can't start my project (vagrant up). I have a vagrant file and so on. What can I do?
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'scotch/box' could not be found. Attempting to find and install
...
default: Box Provider: virtualbox
default: Box Version: >= 0
The box 'scotch/box' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Atlas, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:
URL: ["https://atlas.hashicorp.com/scotch/box"]
There seems to be an issue with vagrant 1.8.7 and the embedded curl version vs the mac os binary (shipped by default on mac os Sierra and others) - remove the embedded one
sudo rm /opt/vagrant/embedded/bin/curl
Note: you also need to remove the embedded curl when you add a vagrant box (remotely or locally) so if you get the same error when running vagrant box add .... just remove the curl from vagrant and it will work
Just wanted to update this post. I ran into this error running macOS Sierra and a fresh Vagrant 1.8.7 install and noticed Vagrant just updated. As of Vagrant 1.9.0 this error appears to have been fixed.
Had a similar problem with Sierra (with additional brew installs - which granted could have an impact).
Above sudo rm /opt/vagrant/embedded/bin/curl did not work still got: SSLRead() return error -36.
Tried suggestion from http://slick.pl/kb/software/vagrant-fix-for-error-60-ssl-read/
Any case:
cd ~
cd .vagrant.d/tmp/
rm -rf ~/.vagrant.d/tmp/
vagrant box add --insecure laravel/homestead
Installed successfully.
I just experienced this error.
In my case I installed vagrant via apt-get which installed 1.7.x..
I removed 1.7.x and installed 2.0.3 directly https://www.vagrantup.com/downloads.html
I had this same problem on MacOS Mojave, and Vagrant version 1.9.3, when trying to use the box: centos/7.
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'centos/7' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
The box 'centos/7' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Atlas, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:
URL: ["https://atlas.hashicorp.com/centos/7"]
Error: The requested URL returned error: 404 Not Found
I updated to Vagrant 2.2.5 and it worked as expected:
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'centos/7' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'centos/7'
default: URL: https://vagrantcloud.com/centos/7
==> default: Adding box 'centos/7' (v1902.01) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/centos/boxes/7/versions/1902.01/providers/virtualbox.box
default: Download redirected to host: cloud.centos.org
==> default: Successfully added box 'centos/7' (v1902.01) for 'virtualbox'!
You should try update Vagrant to the latest version:
sudo add-apt-repository ppa:tiagohillebrandt/vagrant
sudo apt update
This will add a repository for your actual ubuntu version. If you are on 20.10 (groovy) replace groovy with focal and call sudo apt update again.
Then install vagrant again:
sudo apt install vagrant
And update all plugins:
vagrant plugin update

Failed to mount folders in Linux guest - mesg: ttyname failed: Inappropriate ioctl for device

Vagrant won't mount folders. Tried so many solutions, nothing worked.
Versions: Vagrant 1.8.1 / Ubuntu 15.10 / Virtualbox 5.0.16
vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/wily64' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
GuestAdditions 5.0.16 running --- OK.
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /vagrant => C:/Users/User/www/magento-box
default: /vagrant-magento-box-folder => C:/Users/User/www/magento-box-folder
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:
mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group www-data | cut -d: -f3`,dmode=775, fmode=664 vagrant-magento-box-folder /vagrant-magento-box-folder
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g www-data`,dmode=775, fmode=664 vagrant-magento-box-folder /vagrant-magento-box-folder
The error output from the last command was:
mesg: ttyname failed: Inappropriate ioctl for device
In Vagrantfile.config.yml synced folders:
synced_folder:
host_path: "/Users/User/www/magento-box-folder"
guest_path: "/vagrant-magento-box-folder/"
Vagrantfile
require 'yaml'
vagrantConfig = YAML.load_file 'Vagrantfile.config.yml'
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "private_network",
ip: vagrantConfig['ip']
config.vm.synced_folder "#{vagrantConfig['synced_folder']['host_path']}",
"#{vagrantConfig['synced_folder']['guest_path']}",
owner: "vagrant",
group: "www-data",
mount_options:["dmode=775, fmode=664"]
# VirtualBox specific settings
config.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.memory = "2048"
vb.cpus = 2
end
In vagrant ssh I did
sudo ln -s /opt/VBoxGuestAdditions-5.0.16/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions
I replaced VBoxGuestAdditions.iso in tmp
Copy iso fileC:\Program Files/Oracle/VirtualBox/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
Installed vbguest. Have no idea how to solve it..
Here is one important reason why error occurred vagrant up
If you use Virtual Box to Vagrant's provider, you have to reinstall 'Guest Additions' that everytime you create virtual machine's kernel.
vbguest plugin is a good solution for solving this issue.
( about vbguest plugin - https://github.com/dotless-de/vagrant-vbguest )
first, you have to install vbguest plugin.
$ vagrant plugin install vagrant-vbguest
and run Vagrant
$ vagrant halt
$ vagrant up
or use too
vagrant reload
This seems to be a problem with vagrant <= 1.8.4. I did an update to the latest vagrant version (in my case 1.9.3) and everything seems fine again.
Get the latest vagrant version here:
https://www.vagrantup.com/docs/installation/upgrading.html
2.
vagrant halt
3. Install upgrade.
4.
vagrant up

Provisioning vagrant box with chef_ solo

I'm having a problem with the chef-solo provisioner failing with the error
Chef::Exceptions::CookbookNotFound: Cookbook apt not found.
Any ideas on what could be going wrong here and how should I try to troubleshoot this?
Host: Windows 7 64bit, Guest: Ubuntu 12.04
Virtualbox 4.3.20
ChefDK 0.4.0
Vagrant 1.7.2
Vagrant plugins:
vagrant-berkshelf (4.0.2)
vagrant-omnibus (1.4.1)
vagrant-share (1.1.3, system)
Vagrant output:
PS C:\VagrantBoxes\mybox> vagrant reload --provision
default: The Berkshelf shelf is at "C:/Users/dmit77/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150208-6588-1a3oox5-default"
==> default: Sharing cookbooks with VM
==> default: Attempting graceful shutdown of VM...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 4.2.12
default: VirtualBox Version: 4.3
==> default: Mounting shared folders...
default: /vagrant => C:/VagrantBoxes/mybox
default: /tmp/vagrant-chef/7159cf65a6eea91634c03008165d96a8/cookbooks => C:/Users/dkrantsber/.berkshelf/vagrant-berkshelf/shelves/berkshelf20150208-6588-1a3oox5-default
==> default: Running provisioner: chef_solo...
==> default: Detected Chef (latest) is already installed
Generating chef JSON and uploading...
==> default: Running chef-solo...
==> default: stdin: is not a tty
==> default: [2015-02-08T05:09:07+00:00] INFO: *** Chef 11.4.0 ***
==> default: [2015-02-08T05:09:08+00:00] INFO: Setting the run_list to ["recipe[apt]", "recipe[apache2]"] from JSON
==> default: [2015-02-08T05:09:08+00:00] INFO: Run List is [recipe[apt], recipe[apache2]]
==> default: [2015-02-08T05:09:08+00:00] INFO: Run List expands to [apt, apache2]
==> default: [2015-02-08T05:09:08+00:00] INFO: Starting Chef Run for vagrant.vm
==> default: [2015-02-08T05:09:08+00:00] INFO: Running start handlers
==> default: [2015-02-08T05:09:08+00:00] INFO: Start handlers complete.
==> default: [2015-02-08T05:09:08+00:00] ERROR: Running exception handlers
==> default: [2015-02-08T05:09:08+00:00] ERROR: Exception handlers complete
==> default: [2015-02-08T05:09:08+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
==> default: [2015-02-08T05:09:08+00:00] FATAL: Chef::Exceptions::CookbookNotFound: Cookbook apt not found. If you're loading apache2 from another cookbook, make sure you confi
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
Vagrant file:
Vagrant.configure("2") do |config|
config.vm.box = "opscode-ubuntu-12.04_chef-11.4.0"
config.vm.box_url = "https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_chef-11.4.0.box"
config.ssh.forward_agent = true
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = ["cookbooks"]
chef.add_recipe :'apt'
chef.add_recipe 'apache2'
chef.json = {
:apache => {
:default_site_enabled => "true",
:dir => "/etc/apache2",
:log_dir => "/var/log/apache2",
:error_log => "error.log"
}
}
end
end
Folder structure:
[my_box]
[cookbooks]
[apt]
[apache2]
Vagrantfile
I finally came across the solution. It turns out that vagrant-berkshelf plugin is the problem. Uninstalling it resolves the issue.
Vagrant & Chef - Cookbook *** not found

Resources