From 4e865cc9472c5f0052be5f8da86f8c07a579044b Mon Sep 17 00:00:00 2001 From: Patrick Young Date: Tue, 28 Apr 2015 12:13:36 -0400 Subject: [PATCH 1/4] Added GCC to yum-based guest VMs * GCC is required for current Ansible installation process * Fixed an issue with chef/centos-6.5 image not including GCC --- lib/vagrant-guest_ansible/guest_script.sh | 2 +- lib/vagrant-guest_ansible/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/vagrant-guest_ansible/guest_script.sh b/lib/vagrant-guest_ansible/guest_script.sh index 3130b8b..6a84aa4 100644 --- a/lib/vagrant-guest_ansible/guest_script.sh +++ b/lib/vagrant-guest_ansible/guest_script.sh @@ -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 diff --git a/lib/vagrant-guest_ansible/version.rb b/lib/vagrant-guest_ansible/version.rb index 33ba979..f384a48 100644 --- a/lib/vagrant-guest_ansible/version.rb +++ b/lib/vagrant-guest_ansible/version.rb @@ -1,5 +1,5 @@ module Vagrant module GuestAnsible - VERSION = "0.0.2.dev" + VERSION = "0.0.3" end end From 96bdc2c311a51911f1b1c8ee5efa104c32ab4068 Mon Sep 17 00:00:00 2001 From: Caleb Woods Date: Wed, 29 Apr 2015 13:54:27 -0400 Subject: [PATCH 2/4] Cleanup whitespace --- lib/vagrant-guest_ansible/plugin.rb | 2 +- lib/vagrant-guest_ansible/provisioner.rb | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/vagrant-guest_ansible/plugin.rb b/lib/vagrant-guest_ansible/plugin.rb index 4b00eae..e122fef 100644 --- a/lib/vagrant-guest_ansible/plugin.rb +++ b/lib/vagrant-guest_ansible/plugin.rb @@ -21,4 +21,4 @@ class Plugin < Vagrant.plugin("2") end end -end \ No newline at end of file +end diff --git a/lib/vagrant-guest_ansible/provisioner.rb b/lib/vagrant-guest_ansible/provisioner.rb index 09ebfa6..f37f98e 100644 --- a/lib/vagrant-guest_ansible/provisioner.rb +++ b/lib/vagrant-guest_ansible/provisioner.rb @@ -1,5 +1,3 @@ - - module VagrantPlugins module GuestAnsible class Provisioner < Vagrant.plugin("2", :provisioner) @@ -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 @@ -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) @@ -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}") From 7bc60ebae79f8bf59b48699e6b3b7411689990bb Mon Sep 17 00:00:00 2001 From: Caleb Woods Date: Wed, 29 Apr 2015 13:56:14 -0400 Subject: [PATCH 3/4] Fix bug in extra-vars handling Updated to use the same strategy for extra-vars as the builtin Vagrant ansible provisioner. See: https://github.com/mitchellh/vagrant/blob/bdb945cd1b17138133a8e3951de3886baedb75b4/plugins/provisioners/ansible/provisioner.rb#L176 --- lib/vagrant-guest_ansible/guest_script.sh | 4 ++-- lib/vagrant-guest_ansible/provisioner.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/vagrant-guest_ansible/guest_script.sh b/lib/vagrant-guest_ansible/guest_script.sh index 6a84aa4..2e2a914 100644 --- a/lib/vagrant-guest_ansible/guest_script.sh +++ b/lib/vagrant-guest_ansible/guest_script.sh @@ -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 @@ -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 diff --git a/lib/vagrant-guest_ansible/provisioner.rb b/lib/vagrant-guest_ansible/provisioner.rb index f37f98e..e1ea34a 100644 --- a/lib/vagrant-guest_ansible/provisioner.rb +++ b/lib/vagrant-guest_ansible/provisioner.rb @@ -56,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 From 5367a28f796840f0e93b53d5fb5e58b1a1c05db7 Mon Sep 17 00:00:00 2001 From: Caleb Woods Date: Thu, 30 Apr 2015 10:08:11 -0400 Subject: [PATCH 4/4] Add changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..1980758 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,6 @@ +## 0.0.3 + +BUG FIXES: + + - Make sure GCC is installed on CentOS guests + - Fix extra-vars serialization