Skip to content

Commit

Permalink
Fix CentOS and extra-vars bugs (GH #9)
Browse files Browse the repository at this point in the history
  • Loading branch information
calebwoods committed Apr 30, 2015
2 parents 0bc768d + 5367a28 commit 73a2f11
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## 0.0.3

BUG FIXES:

- Make sure GCC is installed on CentOS guests
- Fix extra-vars serialization
6 changes: 3 additions & 3 deletions lib/vagrant-guest_ansible/guest_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

ANSIBLE_PLAYBOOK=$1
ANSIBLE_HOSTS=$2
ANSIBLE_EXTRA_VARS=$3
ANSIBLE_EXTRA_VARS="$3"
TEMP_HOSTS="/tmp/ansible_hosts"

if [ ! -f /vagrant/$ANSIBLE_PLAYBOOK ]; then
Expand All @@ -18,7 +18,7 @@ fi
if ! command -v ansible >/dev/null; then
echo "Installing Ansible dependencies and Git."
if command -v yum >/dev/null; then
sudo yum install -y git python python-devel
sudo yum install -y gcc git python python-devel
elif command -v apt-get >/dev/null; then
sudo apt-get update -qq
#sudo apt-get install -y -qq git python-yaml python-paramiko python-jinja2
Expand All @@ -39,7 +39,7 @@ if ! command -v ansible >/dev/null; then
fi

if [ ! -z "$ANSIBLE_EXTRA_VARS" -a "$ANSIBLE_EXTRA_VARS" != " " ]; then
ANSIBLE_EXTRA_VARS=" --extra-vars \"$ANSIBLE_EXTRA_VARS\""
ANSIBLE_EXTRA_VARS=" --extra-vars $ANSIBLE_EXTRA_VARS"
fi

# stream output
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant-guest_ansible/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ class Plugin < Vagrant.plugin("2")
end

end
end
end
12 changes: 5 additions & 7 deletions lib/vagrant-guest_ansible/provisioner.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


module VagrantPlugins
module GuestAnsible
class Provisioner < Vagrant.plugin("2", :provisioner)
Expand All @@ -15,9 +13,9 @@ def provision
File.basename(self.setup_inventory_file),
format_extra_vars(config.extra_vars)
].join(' ')

command = "chmod +x #{config.upload_path} && #{config.upload_path} #{args}"

with_script_file do |path|

# Upload the script to the machine
Expand All @@ -31,7 +29,7 @@ def provision

@machine.ui.info(I18n.t("vagrant.provisioners.shell.running",
script: path.to_s))

# Execute it with sudo
comm.execute(command, sudo: config.sudo) do |type, data|
if [:stderr, :stdout].include?(type)
Expand All @@ -58,7 +56,7 @@ def format_extra_vars(extra_vars)
if extra_vars.kind_of?(String)
extra_vars.strip
elsif extra_vars.kind_of?(Hash)
extra_vars.map { |k,v| "#{k}=#{v}" }.join(" ")
"\"#{extra_vars.to_json.gsub('"', '\"')}\""
end
end

Expand Down Expand Up @@ -114,7 +112,7 @@ def setup_inventory_file
return config.inventory_path if config.inventory_path

ssh = @machine.ssh_info

generated_inventory_file =
@machine.env.root_path.join("vagrant_ansible_inventory_#{machine.name}")

Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant-guest_ansible/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Vagrant
module GuestAnsible
VERSION = "0.0.2.dev"
VERSION = "0.0.3"
end
end

0 comments on commit 73a2f11

Please sign in to comment.