Skip to content

Commit

Permalink
Merge pull request #326 from daxgames/multiple-extra-vars-files
Browse files Browse the repository at this point in the history
allow array for extra_vars_file.  sorry for taking so long to merge, thanks for your code.
  • Loading branch information
neillturner authored Apr 3, 2021
2 parents b66da8a + a1f1485 commit 57ade70
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/kitchen-ansible/version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- encoding: utf-8 -*-
module Kitchen
module Ansible
VERSION = '0.54.0'.freeze
VERSION = '0.55.0'.freeze
end
end
11 changes: 10 additions & 1 deletion lib/kitchen/provisioner/ansible_playbook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,16 @@ def extra_vars

def extra_vars_file
return nil if config[:extra_vars_file].nil?
bash_extra_vars = "-e '\@#{config[:extra_vars_file]}'"
bash_extra_vars = ''
if config[:extra_vars_file].is_a?(String)
bash_extra_vars = "-e '\@#{config[:extra_vars_file]}'"
elsif config[:extra_vars_file].is_a?(Array)
config[:extra_vars_file].each { |x|
info("Adding -e '\@#{x}'")
bash_extra_vars += " -e '\@#{x}'"
}
end

debug(bash_extra_vars)
bash_extra_vars
end
Expand Down
2 changes: 1 addition & 1 deletion provisioner_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ custom_post_play_command | nil | Custom shell command to be used after the ansib
enable_yum_epel | false | Enable the `yum` EPEL repo
env_vars | Hash.new | Hash to set environment variable to use with `ansible-playbook` command
extra_vars | Hash.new | Hash to set the `extra_vars` passed to `ansible-playbook` command
extra_vars_file | nil | file containing environment variables e.g. `private_vars/production.yml site.yml` Don't prefix with a @ sign.
extra_vars_file | nil | String containing a filename or an Array of filenames containing environment variables e.g. `private_vars/production.yml` or `[file1.yml, file2.yml]` Don't prefix with a @ sign.
filter_plugins_path | filter_plugins | Ansible repo `filter_plugins` directory
galaxy_ignore_certs | false | Ignore certificate errors when installing roles with ansible-galaxy.
group_vars_path | group_vars | Ansible repo group_vars directory
Expand Down

0 comments on commit 57ade70

Please sign in to comment.