{"action":"created","issue":{"url":"https://api.github.com/repos/neillturner/kitchen-ansible/issues/247","repository_url":"https://api.github.com/repos/neillturner/kitchen-ansible","labels_url":"https://api.github.com/repos/neillturner/kitchen-ansible/issues/247/labels{/name}","comments_url":"https://api.github.com/repos/neillturner/kitchen-ansible/issues/247/comments","events_url":"https://api.github.com/repos/neillturner/kitchen-ansible/issues/247/events","html_url":"https://github.com/neillturner/kitchen-ansible/issues/247","id":236195959,"number":247,"title":"provisioner_option 'hosts' should allow multiple group names","user":{"login":"gersilex","id":2018039,"avatar_url":"https://avatars0.githubusercontent.com/u/2018039?v=3","gravatar_id":"","url":"https://api.github.com/users/gersilex","html_url":"https://github.com/gersilex","followers_url":"https://api.github.com/users/gersilex/followers","following_url":"https://api.github.com/users/gersilex/following{/other_user}","gists_url":"https://api.github.com/users/gersilex/gists{/gist_id}","starred_url":"https://api.github.com/users/gersilex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gersilex/subscriptions","organizations_url":"https://api.github.com/users/gersilex/orgs","repos_url":"https://api.github.com/users/gersilex/repos","events_url":"https://api.github.com/users/gersilex/events{/privacy}","received_events_url":"https://api.github.com/users/gersilex/received_events","type":"User","site_admin":false},"labels":[{"id":110057384,"url":"https://api.github.com/repos/neillturner/kitchen-ansible/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-06-15T13:41:17Z","updated_at":"2017-06-19T18:40:14Z","closed_at":null,"body":"A host can be in multiple groups, not just one.\r\n\r\nFor example: A host may be in a group 'webservers' and in a group 'production'. When deploying, every host is definitely in either 'production' or 'staging' AND in either 'webservers' or 'dbservers'.\r\n\r\nProgrammatically I would think of allowing a list of `hosts` and creating a inventory block `for every hosts entry`."},"comment":{"url":"https://api.github.com/repos/neillturner/kitchen-ansible/issues/comments/309529040","html_url":"https://github.com/neillturner/kitchen-ansible/issues/247#issuecomment-309529040","issue_url":"https://api.github.com/repos/neillturner/kitchen-ansible/issues/247","id":309529040,"user":{"login":"neillturner","id":408419,"avatar_url":"https://avatars0.githubusercontent.com/u/408419?v=3","gravatar_id":"","url":"https://api.github.com/users/neillturner","html_url":"https://github.com/neillturner","followers_url":"https://api.github.com/users/neillturner/followers","following_url":"https://api.github.com/users/neillturner/following{/other_user}","gists_url":"https://api.github.com/users/neillturner/gists{/gist_id}","starred_url":"https://api.github.com/users/neillturner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neillturner/subscriptions","organizations_url":"https://api.github.com/users/neillturner/orgs","repos_url":"https://api.github.com/users/neillturner/repos","events_url":"https://api.github.com/users/neillturner/events{/privacy}","received_events_url":"https://api.github.com/users/neillturner/received_events","type":"User","site_admin":false},"created_at":"2017-06-19T18:40:14Z","updated_at":"2017-06-19T18:40:14Z","body":"```\r\n      def prepare_hosts\r\n        return if ansible_inventory\r\n        info('Preparing hosts file')\r\n\r\n        if config[:hosts].nil?\r\n          fail 'No hosts have been set. Please specify one in .kitchen.yml'\r\n        else\r\n          debug(\"Using host from #{hosts}\")\r\n          File.open(File.join(sandbox_path, 'hosts'), 'wb') do |file|\r\n            file.write(\"localhost ansible_connection=local\\n[#{hosts}]\\nlocalhost\\n\")\r\n          end\r\n        end\r\n      end\r\n\r\ngoes to \r\n\r\n      def prepare_hosts\r\n        return if ansible_inventory\r\n        info('Preparing hosts file')\r\n\r\n        if config[:hosts].nil?\r\n          fail 'No hosts have been set. Please specify one in .kitchen.yml'\r\n        elsif config[:hosts].is_a?(Array)\r\n          debug(\"Using an array of hosts from #{hosts}\")\r\n          File.open(File.join(sandbox_path, 'hosts'), 'wb') do |file|\r\n            hoststring=\"localhost ansible_connection=local\\n\"\r\n            config[:hosts].each do |h|\r\n              hoststring+=\"[#{h}]\\nlocalhost\\n\"\r\n            end\r\n            file.write(hoststring)\r\n          end\r\n        else\r\n          debug(\"Using host from #{hosts}\")\r\n          File.open(File.join(sandbox_path, 'hosts'), 'wb') do |file|\r\n            file.write(\"localhost ansible_connection=local\\n[#{hosts}]\\nlocalhost\\n\")\r\n          end\r\n        end\r\n      end\r\n```"}}
{"actor":{"display_login":"neillturner"}}