-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Salt provisioner fails to upload minion config #5973
Comments
I can confirm this. We're currently experiencing this issue, too. |
I can confirm this as well. I'm using Vagrant 1.7.3 with VirtualBox 5.0. As a workaround I've been using a shell provisioner with the following to make sure salt in installed and the config is copied over:
|
I can confirm this issue. As a workaround, I specified |
Same issue with provider vmware_desktop. |
I've got this issue too |
I can confirm the issue too |
This also started happening to me after upgrading to Vagrant 1.7.4. |
Same experience here using vagrant 1.7.3 and 1.7.4 on both Virtual Box 4.3 and 5 using OSX Yosemite. |
@sephlaire could you explain your workaround in more detail? |
@Jake223 Vagrantfile# -*- mode: ruby -*-
# # vi: set ft=ruby :
# Specify minimum Vagrant version and Vagrant API version
Vagrant.require_version ">= 1.6.0"
VAGRANTFILE_API_VERSION = "2"
# Require YAML module
require 'yaml'
# Read YAML file with box details
servers = YAML.load_file('servers.yaml')
# Create boxes
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Iterate through entries in YAML file
servers.each do |servers|
config.vm.define servers["name"] do |srv|
srv.vm.box = servers["box"]
srv.vm.network "private_network", ip: servers["ip"]
srv.vm.hostname = servers["hostname"]
srv.vm.provision "shell", path: servers["bootstrap"] unless servers["bootstrap"].nil?
srv.vm.network "forwarded_port", guest: servers["guest_port"], host: servers["host_port"] unless servers["guest_port"].nil? || servers["host_port"].nil?
srv.vm.synced_folder servers["sync-local"], servers["sync-remote"] unless servers["sync-local"].nil? || servers["sync-remote"].nil?
srv.vm.provider :virtualbox do |vb|
vb.name = servers["name"]
vb.memory = servers["ram"]
end
unless servers["minion_config"].nil?
# srv.vm.provision "file", source: servers["minion_config"], destination: "/etc/salt/minion"
srv.vm.provision :salt do |salt|
salt.run_highstate = true
salt.minion_config = servers["minion_config"]
salt.minion_key = servers["minion_key"] unless servers["minion_key"].nil?
salt.minion_pub = servers["minion_pub"] unless servers["minion_pub"].nil?
end
end
end
end
end servers.yaml---
- name: ubuntu
hostname: ubuntu
box: ubuntu/trusty64
ram: 1024
ip: 10.1.15.11
bootstrap: ubuntu_bootstrap.sh
sync-local: ./salt/roots
sync-remote: /srv/salt
minion_config: ./salt/configs/ubuntu.conf
minion_key: ./salt/ssh-key/ubuntu.pem
minion_pub: ./salt/ssh-key/ubuntu.pub
- name: centos
hostname: centos
box: chef/centos-7.0
ram: 1024
ip: 10.1.15.12
bootstrap: centos_bootstrap.sh
sync-local: ./salt/roots
sync-remote: /srv/salt
minion_config: ./salt/configs/centos.conf
minion_key: ./salt/ssh-key/centos.pem
minion_pub: ./salt/ssh-key/centos.pub ubunt_bootstrap.sh#!/usr/bin/env bash
echo "Setup saltstack PPA"
sudo apt-get install software-properties-common python-software-properties -y >> /dev/null
sudo add-apt-repository ppa:saltstack/salt -y >> /dev/null
sudo apt-get update >> /dev/null
echo "Installing salt-minion"
sudo apt-get install salt-minion -y >> /dev/null
sudo cp /vagrant/salt/configs/ubuntu.conf /etc/salt/minion
echo "Restart salt-minion"
sudo salt-minion -d
sudo service salt-minion restart
sudo salt-call state.highstate |
The workaround that worked for me is as follows In
In
|
Also seeing the same issue. Also, to add to this current issue, I noticed that when provisioning salt-master, while vagrant won't necessarily error when specifying a configuration file, it won't use the specified file either. For those looking for yet another workaround, this is what I did: # SALT MASTER
saltmaster.vm.provision :salt do |salt|
salt.master_config = "salt/configs/master" # this line seems ignored, or may be failing silently
salt.install_master = true
salt.no_minion = true
salt.install_type = "git"
salt.install_args = "v2015.5.1"
end # salt provisioner
saltmaster.vm.provision "shell",
inline: "sudo cp /vagrant/salt/configs/master /etc/salt/master && sudo service salt-master restart"
# SALT MINION
machine.vm.provision :salt do |salt|
# note: no salt.minion_config line here... if you include it here, it will fail
salt.install_master = false
salt.no_minion = false
salt.install_type = "git"
salt.install_args = "v2015.5.1"
end # salt provisioner
machine.vm.provision "shell",
inline: "sudo cp /vagrant/salt/configs/minion_local /etc/salt/minion && sudo service salt-minion restart"
|
This is rather unfortunate as, for example, Debian jessie sets Is there a way to utilise sudo in the copy process ? |
@BABILEN I would recommend using a custom box image |
@nmadhok Well, we are, but I am hesitant to change that globally in our vagrant cloud, simply because the provisioner is buggy. I'd rather recommend that people don't upgrade their vagrant installation from 1.7.2 yet. |
@BABILEN I agree |
Can confirm this one too, trusty64 seems to restrict root login too... |
Any chance of getting this fixed for 1.7.5? |
Echoing @davidkarlsen's question. Any other info, ETA, etc.? |
Worked around this permission problem as well by following @CharlesLovely comment by 'manually' copying over the minion config file and commenting out the salt.minion_config
|
I'm on the same boat, tried to use @jberends solution but it comes to a point where the highstate just hangs. My guess salt provisioner is trying to run with default minion config before copying the actual minion config file. for reference Project structure:
Vagrantfile:
minion:
tops.sls:
webserver.sls:
|
I've given up on 1.7.3 and 1.7.4. Something regressed after 1.7.2. |
@pcn was it broken before 1.7.2 ? |
I ran into the issue on 1.7.2, ended up using @amchoukir s workaround |
I returned to 1.7.2 and can provision again... next timr I check the issues before blindly updating my dev box |
this is the 2nd issue w/ salt provisioner today for me (saltstack/salt-bootstrap#648 is the other one); i think @zundra's advice is best for now till vagrant 1.8. or some patch fix to 1.7.x. substituting the salt provisioner w/ a shell provisioner doing the same thing is not a valid maintainable fix - I could do this and have for other provisioners in the past - but ain't nobody got time for that. @nmadhok - if you did get this to work w/ your workaround above - can you kindly post your Vagrantfile - I get auth issues upon trying what you suggest; maybe I'm putting it in the wrong spot of my Vagrantfile. UPDATE (FWIW/ to help anyone else): |
@tehmaspc out of curiosity why do you think a shell provisionner is not a maintainable solution. Vagrant caters to type 2 hypervisors, I.e the hypervisors runs as an application on a host OS and allow to run guest operating systems. For type 1 hypervisors, the hypervisor runs bare metal not on top of a host operating system. Examples would be VMWare ESXi, Citrix Xenserver and so on. Type 1 hypervisor are the heavy duty case running hundred if not thousands of VMs and Salt would most likely be installed via a shell script or through a gold image/template. |
Excerpt from a working Vagrantfile (with a workaround applied):
Is this issue still affecting Salt 2015.5.5 or 2015.8.0RCs? |
@edvinasme This bug exists regardless of the salt version. If it helps anyone else, here's what I did. In my case I'm passing pillar data along in my Vagrantfile so I can't just make it provision using a shell command. Instead I make it copy the minion config to conf.vm.provision :file, source: "provision/minion", destination: "/tmp/minion"
conf.vm.provision :salt do |salt|
# Custom pillar
salt.pillar("user_options" => vmopts['options'].presence || {})
salt.pillar("user_packages" => vmopts['packages'].presence || {})
salt.pillar("timezone" => zone)
# Salt options
salt.minion_config = "provision/minion"
salt.run_highstate = true
salt.install_type = "git"
salt.install_args = "v2015.8.0rc3"
salt.bootstrap_options = "-P -c /tmp"
salt.colorize = true
salt.verbose = true
salt.log_level = "info"
# salt.always_install = true
end |
@tehmaspc I can confirm vagrant 1.7.4 and Virtualbox 5 works with the above fix... which looks like the following for me.. config.vm.provision :file, source: "./.vagrant-salt/minion", destination: "/tmp/minion"
# Provision VM with current formula, in masterless mode
config.vm.provision :salt do |salt|
salt.minion_config = "./.vagrant-salt/minion"
salt.run_highstate = true
salt.install_type = 'git v2015.5.5'
salt.bootstrap_options = "-P -c /tmp"
salt.colorize = true
salt.verbose = true
end |
Hi all, I stumbled over this issue because my setup for minion boxes (pre Vagrant 1.7.2) was no longer working with 1.7.4 too. After some gruesome debugging (eyes still hurting) I found out that vagrant uploads the keys and configuration only to the "tmpdir" (in Linux this is /tmp) as user "vagrant". So I gave the bootstrap script some options via [...]
$minion_script = <<EOF
yum remove -y salt\*
echo $(hostname -f) > /etc/salt/minion_id
EOF
[...]
minionc6.vm.provision "shell",
inline: $minion_script
minionc6.vm.provision :salt do |salt|
salt.bootstrap_options = '-F -c /tmp/'
salt.minion_config = "provision/minion_config"
salt.minion_key = "provision/keys/minion.pem"
salt.minion_pub = "provision/keys/minion.pub"
salt.colorize = true
salt.log_level = "info"
salt.verbose = true
end
[...] So I think that either the documentation should state the usage of the switches to bootstrap when provisioning keys and config or vagrant could do it by itself. |
@bemeyert works for me. Many thx for sharing it. |
@robertw Glad I could help ;) |
TL;DR: Add
|
Exactly what I found as well. I wasn't sure how #6029 should be fixed. If we include Maybe we should include |
There are unresolved issues with Vagrant 1.7.3 and 1.7.4 See: hashicorp/vagrant#5973
@bsuh - LMAO - great post formatting. |
Fixed by #6073 |
👍 Thanks! |
Hooray! Thaks! Hope we will get new 1.8.0 release soon |
Thank You! |
@mitchellh Wow - lot's of salt provisioner merges today- thanks a lot! |
@bsuh 👍 |
Got the same error then I just wrote the commands on cmd instead of git console and it worked. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Ran into a problem in 1.7.3 doing a vagrant up using a trusty64 box with a salt provisioner specifying a custom minion_config. This is the error:
It appears that the vagrant user does not have permission by default to scp to /etc/salt/ so provisioning fails. I confirmed it is possible to vagrant ssh into the machine and change the permissions/owner on /etc/salt/ and then the provisioning will work OK.
It appears 74d2206 may have been the breaking change as it introduced the uploading to /etc/salt.
The text was updated successfully, but these errors were encountered: