Skip to content

Commit

Permalink
hosts group list
Browse files Browse the repository at this point in the history
  • Loading branch information
neillturner committed Jun 24, 2017
1 parent 0d4bcf3 commit eb8a30d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 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.47.1'.freeze
VERSION = '0.47.2'.freeze
end
end
9 changes: 9 additions & 0 deletions lib/kitchen/provisioner/ansible_playbook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,15 @@ def prepare_hosts

if config[:hosts].nil?
fail 'No hosts have been set. Please specify one in .kitchen.yml'
elsif config[:hosts].is_a?(Array)
debug("Using an array of hosts from #{hosts}")
File.open(File.join(sandbox_path, 'hosts'), 'wb') do |file|
hoststring="localhost ansible_connection=local\n"
config[:hosts].each do |h|
hoststring+="[#{h}]\nlocalhost\n\n"
end
file.write(hoststring)
end
else
debug("Using host from #{hosts}")
File.open(File.join(sandbox_path, 'hosts'), 'wb') do |file|
Expand Down
2 changes: 1 addition & 1 deletion provisioner_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ extra_vars_file | nil | file containing environment variables e.g. `private_vars
filter_plugins_path | filter_plugins | Ansible repo `filter_plugins` directory
group_vars_path | group_vars | Ansible repo group_vars directory
host_vars_path | host_vars | Ansible repo hosts directory
hosts | | Create Ansible hosts file for localhost with this server group
hosts | | Create Ansible hosts file for localhost with this server group or list of groups
http_proxy | nil | Use HTTP proxy when installing Ansible, packages and running Ansible
https_proxy | nil | Use HTTPS proxy when installing Ansible, packages and running Ansible
idempotency_test | false | Enable to test Ansible playbook idempotency
Expand Down

0 comments on commit eb8a30d

Please sign in to comment.