kitchen-ansible 0.44.6 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7fbf1e47a7ca285b3ae2dba5f2ae82a112a6f9de
4
- data.tar.gz: e0f3f3fd2e1736f45c0ab0735946db1d61f03350
3
+ metadata.gz: ec676d759c7b80412dd7bce395846610630f2c3f
4
+ data.tar.gz: b46200840a7879d800dc956710fe7ffa244a9939
5
5
  SHA512:
6
- metadata.gz: aa72291e7fae7d2e2910344e4b1d08cd08a32c3c9bc31df1e25b03b3a0b094a776c7dca030e2f6560d439a51e44dadf77df1971aa20bd9710c6060fd46afcabe
7
- data.tar.gz: be14119c1cc4a5f36cb91a3d2dc005c87df77446440aac3eb6f4e2f731bf9ff8469f1665b6f018dff10c0e238e99d34b98c8d1c7907586a958bea5ae14a32a48
6
+ metadata.gz: 7338b84eb30b81dc10c962ab8b5922b9314da38f75fac1b3d81742780a6bc7160b23e97289618f620bd91741ac401f8a0d6119169457a04de759449559805079
7
+ data.tar.gz: fd5abc21918db6188fbc02fb29dba2d13fb22b3225155edbdfd3dd411c5f844feb9e28d1d69b597376a915b5251b841ed9e5eee10bd5fb07b9bb2b25c74c4cf4
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  module Kitchen
3
3
  module Ansible
4
- VERSION = '0.44.6'
4
+ VERSION = '0.45.0'
5
5
  end
6
6
  end
@@ -39,6 +39,7 @@ module Kitchen
39
39
  default_config :require_ansible_repo, true
40
40
  default_config :enable_yum_epel, false
41
41
  default_config :extra_vars, {}
42
+ default_config :env_vars, {}
42
43
  default_config :tags, []
43
44
  default_config :ansible_apt_repo, 'ppa:ansible/ansible'
44
45
  default_config :ansible_yum_repo, nil
@@ -20,6 +20,7 @@
20
20
  require 'json'
21
21
  require 'kitchen/provisioner/ansible/os/debian'
22
22
  require 'kitchen/provisioner/ansible/os/redhat'
23
+ require 'kitchen/provisioner/ansible/os/fedora'
23
24
  require 'kitchen/provisioner/ansible/os/amazon'
24
25
  require 'kitchen/provisioner/ansible/os/suse'
25
26
 
@@ -40,8 +41,10 @@ module Kitchen
40
41
  case platform
41
42
  when 'debian', 'ubuntu'
42
43
  return Debian.new(platform, config)
43
- when 'redhat', 'centos', 'fedora'
44
+ when 'redhat', 'centos'
44
45
  return Redhat.new(platform, config)
46
+ when 'fedora'
47
+ return Fedora.new(platform, config)
45
48
  when 'amazon'
46
49
  return Amazon.new(platform, config)
47
50
  when 'suse', 'opensuse', 'sles'
@@ -0,0 +1,60 @@
1
+ # -*- encoding: utf-8 -*-
2
+ #
3
+ # Author:: Michael Heap (<m@michaelheap.com>)
4
+ # Mark McKinstry
5
+ #
6
+ # Copyright (C) 2015 Michael Heap
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+ #
20
+
21
+ module Kitchen
22
+ module Provisioner
23
+ module Ansible
24
+ class Os
25
+ class Fedora < Os
26
+ def install_command
27
+ <<-INSTALL
28
+
29
+ if [ ! $(which ansible) ]; then
30
+ #{redhat_yum_repo}
31
+ #{update_packages_command}
32
+ #{sudo_env('dnf')} -y install #{ansible_package_name} libselinux-python git python2-dnf
33
+ fi
34
+ INSTALL
35
+ end
36
+
37
+ def update_packages_command
38
+ @config[:update_package_repos] ? "#{sudo_env('dnf')} makecache" : nil
39
+ end
40
+
41
+ def ansible_package_name
42
+ if @config[:ansible_version] == 'latest' || @config[:ansible_version] == nil
43
+ "ansible"
44
+ else
45
+ "ansible#{@config[:ansible_version][0..2]}-#{@config[:ansible_version]}"
46
+ end
47
+ end
48
+
49
+ def redhat_yum_repo
50
+ if @config[:ansible_yum_repo]
51
+ <<-INSTALL
52
+ #{sudo_env('rpm')} -ivh #{@config[:ansible_yum_repo]}
53
+ INSTALL
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -85,7 +85,9 @@ module Kitchen
85
85
  cmd = <<-INSTALL
86
86
 
87
87
  if [ ! $(which ansible) ]; then
88
- if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ]; then
88
+ if [ -f /etc/fedora-release ]; then
89
+ #{Kitchen::Provisioner::Ansible::Os::Fedora.new('fedora', config).install_command}
90
+ elif [ -f /etc/centos-release ] || [ -f /etc/redhat-release ]; then
89
91
  if [ -z `grep -q 'Amazon Linux' /etc/system-release` ]; then
90
92
  #{Kitchen::Provisioner::Ansible::Os::Redhat.new('redhat', config).install_command}
91
93
  else
@@ -347,6 +349,7 @@ module Kitchen
347
349
  cmd = ansible_command('ansible-playbook')
348
350
  end
349
351
 
352
+ cmd = "#{env_vars} #{cmd}" if !config[:env_vars].none?
350
353
  cmd = "HTTPS_PROXY=#{https_proxy} #{cmd}" if https_proxy
351
354
  cmd = "HTTP_PROXY=#{http_proxy} #{cmd}" if http_proxy
352
355
  cmd = "NO_PROXY=#{no_proxy} #{cmd}" if no_proxy
@@ -554,6 +557,11 @@ module Kitchen
554
557
  config[:requirements_path] || nil
555
558
  end
556
559
 
560
+ def env_vars
561
+ return nil if config[:env_vars].none?
562
+ config[:env_vars].map { |k, v| "#{k}=#{v}" }.join(' ')
563
+ end
564
+
557
565
  def playbook
558
566
  config[:playbook]
559
567
  end
@@ -52,6 +52,7 @@ ansiblefile_path | | Path to Ansiblefile
52
52
  callback_plugins_path | callback_plugins | Ansible repo `callback_plugins` directory
53
53
  chef_bootstrap_url | `https://www.getchef.com/chef/install.sh` | The Chef install
54
54
  enable_yum_epel | false | Enable the `yum` EPEL repo
55
+ env_vars | Hash.new | Hash to set environment variable to use with `ansible-playbook` command
55
56
  extra_vars | Hash.new | Hash to set the `extra_vars` passed to `ansible-playbook` command
56
57
  filter_plugins_path | filter_plugins | Ansible repo `filter_plugins` directory
57
58
  group_vars_path | group_vars | Ansible repo group_vars directory
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-ansible
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.44.6
4
+ version: 0.45.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neill Turner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-11 00:00:00.000000000 Z
11
+ date: 2016-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -103,6 +103,7 @@ files:
103
103
  - lib/kitchen/provisioner/ansible/os.rb
104
104
  - lib/kitchen/provisioner/ansible/os/amazon.rb
105
105
  - lib/kitchen/provisioner/ansible/os/debian.rb
106
+ - lib/kitchen/provisioner/ansible/os/fedora.rb
106
107
  - lib/kitchen/provisioner/ansible/os/redhat.rb
107
108
  - lib/kitchen/provisioner/ansible/os/suse.rb
108
109
  - lib/kitchen/provisioner/ansible_playbook.rb