kitchen-ansible 0.49.1 → 0.53.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/kitchen-ansible.gemspec +1 -2
- data/lib/kitchen-ansible/version.rb +1 -1
- data/lib/kitchen/provisioner/ansible/config.rb +8 -0
- data/lib/kitchen/provisioner/ansible/os/debian.rb +3 -1
- data/lib/kitchen/provisioner/ansible/os/fedora.rb +7 -1
- data/lib/kitchen/provisioner/ansible/os/redhat.rb +7 -1
- data/lib/kitchen/provisioner/ansible_playbook.rb +59 -6
- data/provisioner_options.md +21 -0
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 621c646a7a42d16e3401ec6f19f81db5c6fb80833364f00ffbc5513458eea3e8
|
4
|
+
data.tar.gz: 2ffc7fc71b039fa565859c199d16b52d3f7a786049cb4032b9ac43a6405b3f0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f66c6917ac9dcf3629c9ed5d1498810806e7f8899d984f5b62def95bef9caa3617d81e3fe42f05f7af8f811c06f0e9b3fc576600476660390bf324f4aedd3fe6
|
7
|
+
data.tar.gz: 325f1fd0213b1f6525afed073eed515fb0ab38b5b4e8fac23af931892f590f32fbafb6d98302cb6382c3bba3a92cd45cc8cc4a1977be6e945adfd3a7be506050
|
data/kitchen-ansible.gemspec
CHANGED
@@ -29,7 +29,6 @@ EOF
|
|
29
29
|
s.add_development_dependency 'rspec'
|
30
30
|
s.add_development_dependency 'pry'
|
31
31
|
s.add_development_dependency 'rake'
|
32
|
-
s.
|
33
|
-
s.add_dependency 'test-kitchen', '~> 1.4'
|
32
|
+
s.add_dependency 'test-kitchen', '>= 1.4'
|
34
33
|
s.add_dependency 'net-ssh', '>= 3'
|
35
34
|
end
|
@@ -54,7 +54,9 @@ module Kitchen
|
|
54
54
|
default_config :require_ruby_for_busser, false
|
55
55
|
default_config :require_windows_support, false
|
56
56
|
default_config :require_pip, false
|
57
|
+
default_config :require_pip3, false
|
57
58
|
default_config :requirements_path, false
|
59
|
+
default_config :requirements_collection_path, false
|
58
60
|
default_config :ssh_known_hosts, nil
|
59
61
|
default_config :additional_ssh_private_keys, nil
|
60
62
|
default_config :ansible_verbose, false
|
@@ -103,6 +105,12 @@ module Kitchen
|
|
103
105
|
fail('No roles_path detected. Please specify one in .kitchen.yml')
|
104
106
|
end
|
105
107
|
|
108
|
+
default_config :ansible_binary_path do |provisioner|
|
109
|
+
if provisioner[:require_pip3]
|
110
|
+
fail('No ansible_binary_path detected. Please specify one in .kitchen.yml')
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
106
114
|
default_config :group_vars_path do |provisioner|
|
107
115
|
provisioner.calculate_path('group_vars', :directory)
|
108
116
|
end
|
@@ -55,7 +55,9 @@ module Kitchen
|
|
55
55
|
#{sudo_env('apt-get')} -y install software-properties-common
|
56
56
|
|
57
57
|
## 10.04, 12.04 include add-apt-repository in
|
58
|
-
|
58
|
+
if [apt-cache pkgnames | grep -q 'python-software-properties']; then
|
59
|
+
#{sudo_env('apt-get')} -y install python-software-properties
|
60
|
+
fi
|
59
61
|
|
60
62
|
## 10.04 version of add-apt-repository doesn't accept --yes
|
61
63
|
## later versions require interaction from user, so we must specify --yes
|
@@ -29,7 +29,13 @@ module Kitchen
|
|
29
29
|
if [ ! $(which ansible) ]; then
|
30
30
|
#{redhat_yum_repo}
|
31
31
|
#{update_packages_command}
|
32
|
-
|
32
|
+
FEDORA_RELEASE=$(rpm --query --queryformat="%{VERSION}" --file /etc/fedora-release)
|
33
|
+
|
34
|
+
if [ ${FEDORA_RELEASE} -le 28 ]; then
|
35
|
+
#{sudo_env('dnf')} -y install #{ansible_package_name} libselinux-python git python2-dnf
|
36
|
+
else
|
37
|
+
#{sudo_env('dnf')} -y install #{ansible_package_name} python3-libselinux git python3-dnf
|
38
|
+
fi
|
33
39
|
fi
|
34
40
|
INSTALL
|
35
41
|
end
|
@@ -29,7 +29,13 @@ module Kitchen
|
|
29
29
|
#{install_epel_repo}
|
30
30
|
#{redhat_yum_repo}
|
31
31
|
#{update_packages_command}
|
32
|
-
|
32
|
+
EL_RELEASE=$(rpm -E %{rhel})
|
33
|
+
|
34
|
+
if [ "${EL_RELEASE}" -lt 8 ]; then
|
35
|
+
#{sudo_env('yum')} -y install #{ansible_package_name} libselinux-python git
|
36
|
+
else
|
37
|
+
#{sudo_env('yum')} -y install #{ansible_package_name} python3-libselinux git
|
38
|
+
fi
|
33
39
|
fi
|
34
40
|
INSTALL
|
35
41
|
end
|
@@ -76,6 +76,9 @@ module Kitchen
|
|
76
76
|
elsif config[:require_pip]
|
77
77
|
info('Installing ansible through pip')
|
78
78
|
cmd = install_ansible_from_pip_command
|
79
|
+
elsif config[:require_pip3]
|
80
|
+
info('Installing ansible through pip3')
|
81
|
+
cmd = install_ansible_from_pip3_command
|
79
82
|
elsif config[:require_ansible_repo]
|
80
83
|
if !@os.nil?
|
81
84
|
info("Installing ansible on #{@os.name}")
|
@@ -264,7 +267,7 @@ module Kitchen
|
|
264
267
|
end
|
265
268
|
|
266
269
|
def init_command
|
267
|
-
dirs = %w(modules roles group_vars host_vars)
|
270
|
+
dirs = %w(modules roles group_vars host_vars collections)
|
268
271
|
.map { |dir| File.join(config[:root_path], dir) }.join(' ')
|
269
272
|
cmd = "#{sudo_env('rm')} -rf #{dirs};"
|
270
273
|
cmd += " mkdir -p #{config[:root_path]}"
|
@@ -308,7 +311,7 @@ module Kitchen
|
|
308
311
|
commands = []
|
309
312
|
|
310
313
|
commands << [
|
311
|
-
"if [ $(uname -s)
|
314
|
+
"if [ $(uname -s) = 'FreeBSD' ]; then ETC_ANSIBLE='/usr/local/etc/ansible'; else ETC_ANSIBLE='/etc/ansible'; fi"
|
312
315
|
]
|
313
316
|
# Prevent failure when ansible package installation doesn't contain /etc/ansible
|
314
317
|
commands << [
|
@@ -373,6 +376,10 @@ module Kitchen
|
|
373
376
|
commands << ansible_galaxy_command
|
374
377
|
end
|
375
378
|
|
379
|
+
if galaxy_requirements_collections
|
380
|
+
commands << ansible_galacy_collection_command
|
381
|
+
end
|
382
|
+
|
376
383
|
if kerberos_conf_file
|
377
384
|
commands << [
|
378
385
|
sudo_env('cp -f'), File.join(config[:root_path], 'krb5.conf'), '/etc'
|
@@ -473,6 +480,18 @@ module Kitchen
|
|
473
480
|
cmd
|
474
481
|
end
|
475
482
|
|
483
|
+
def ansible_galacy_collection_command
|
484
|
+
cmd = [
|
485
|
+
'ansible-galaxy', 'collection', 'install', '--force',
|
486
|
+
'-p', File.join(config[:root_path], 'collections'),
|
487
|
+
'-r', File.join(config[:root_path], galaxy_requirements_collections)
|
488
|
+
].join(' ')
|
489
|
+
cmd = "https_proxy=#{https_proxy} #{cmd}" if https_proxy
|
490
|
+
cmd = "http_proxy=#{http_proxy} #{cmd}" if http_proxy
|
491
|
+
cmd = "no_proxy=#{no_proxy} #{cmd}" if no_proxy
|
492
|
+
cmd
|
493
|
+
end
|
494
|
+
|
476
495
|
def cd_ansible
|
477
496
|
# this is not working so just return nil for now
|
478
497
|
# File.exist?('ansible.cfg') ? "cd #{config[:root_path]};" : nil
|
@@ -546,6 +565,36 @@ module Kitchen
|
|
546
565
|
INSTALL
|
547
566
|
end
|
548
567
|
|
568
|
+
def install_ansible_from_pip3_command
|
569
|
+
if config[:ansible_version]=='latest' or config[:ansible_version].nil?
|
570
|
+
ansible_version = ''
|
571
|
+
else
|
572
|
+
ansible_version = "==#{config[:ansible_version]}"
|
573
|
+
end
|
574
|
+
<<-INSTALL
|
575
|
+
if [ ! $(which ansible) ]; then
|
576
|
+
if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ]; then
|
577
|
+
#{Kitchen::Provisioner::Ansible::Os::Redhat.new('redhat', config).install_epel_repo}
|
578
|
+
#{update_packages_redhat_cmd} > #{detect_debug}
|
579
|
+
#{sudo_env('yum')} -y install python3-libselinux python3-devel python3-pip git libffi-devel openssl-devel gcc > #{detect_debug}
|
580
|
+
else
|
581
|
+
if [ -f /etc/SUSE-brand ] || [ -f /etc/SuSE-release ]; then
|
582
|
+
#{sudo_env('zypper')} ar #{python_sles_repo} > #{detect_debug}
|
583
|
+
#{update_packages_suse_cmd} > #{detect_debug}
|
584
|
+
#{sudo_env('zypper')} --non-interactive install python python-devel git python-setuptools python-pip python-six libyaml-devel libffi-devel libopenssl-devel > #{detect_debug}
|
585
|
+
else
|
586
|
+
#{update_packages_debian_cmd} > #{detect_debug}
|
587
|
+
#{sudo_env('apt-get')} -y install git python python-pip python-setuptools build-essential python-dev libffi-dev libssl-dev > #{detect_debug}
|
588
|
+
fi
|
589
|
+
fi
|
590
|
+
|
591
|
+
#{export_http_proxy}
|
592
|
+
#{sudo_env('pip3')} install -U setuptools > #{detect_debug}
|
593
|
+
#{sudo_env('pip3')} install ansible#{ansible_version} > #{detect_debug}
|
594
|
+
fi
|
595
|
+
INSTALL
|
596
|
+
end
|
597
|
+
|
549
598
|
def install_omnibus_command
|
550
599
|
info('Installing ansible using ansible omnibus')
|
551
600
|
|
@@ -629,6 +678,10 @@ module Kitchen
|
|
629
678
|
config[:requirements_path] || nil
|
630
679
|
end
|
631
680
|
|
681
|
+
def galaxy_requirements_collections
|
682
|
+
config[:requirements_collection_path] || nil
|
683
|
+
end
|
684
|
+
|
632
685
|
def env_vars
|
633
686
|
return nil if config[:env_vars].none?
|
634
687
|
config[:env_vars].map { |k, v| "#{k}=#{v}" }.join(' ')
|
@@ -921,10 +974,10 @@ module Kitchen
|
|
921
974
|
roles_paths << File.join(config[:root_path], 'roles') unless config[:roles_path].nil?
|
922
975
|
if config[:additional_copy_role_path]
|
923
976
|
if config[:additional_copy_role_path].is_a? String
|
924
|
-
roles_paths << File.join(config[:root_path], File.basename(config[:additional_copy_role_path]))
|
977
|
+
roles_paths << File.join(config[:root_path], 'roles', File.basename(config[:additional_copy_role_path]))
|
925
978
|
else
|
926
979
|
config[:additional_copy_role_path].each do |path|
|
927
|
-
roles_paths << File.join(config[:root_path], File.basename(File.expand_path(path)))
|
980
|
+
roles_paths << File.join(config[:root_path], 'roles', File.basename(File.expand_path(path)))
|
928
981
|
end
|
929
982
|
end
|
930
983
|
end
|
@@ -952,12 +1005,12 @@ module Kitchen
|
|
952
1005
|
if config[:additional_copy_role_path]
|
953
1006
|
if config[:additional_copy_role_path].is_a? String
|
954
1007
|
debug("Using additional roles copy from #{File.expand_path(config[:additional_copy_role_path])}")
|
955
|
-
dest = File.join(sandbox_path, File.basename(File.expand_path(config[:additional_copy_role_path])))
|
1008
|
+
dest = File.join(sandbox_path, 'roles', File.basename(File.expand_path(config[:additional_copy_role_path])))
|
956
1009
|
FileUtils.mkdir_p(File.dirname(dest))
|
957
1010
|
FileUtils.cp_r(File.expand_path(config[:additional_copy_role_path]), dest)
|
958
1011
|
else
|
959
1012
|
config[:additional_copy_role_path].each do |path|
|
960
|
-
dest = File.join(sandbox_path, File.basename(File.expand_path(path)))
|
1013
|
+
dest = File.join(sandbox_path, 'roles', File.basename(File.expand_path(path)))
|
961
1014
|
FileUtils.mkdir_p(File.dirname(dest))
|
962
1015
|
FileUtils.cp_r(File.expand_path(path), dest)
|
963
1016
|
end
|
data/provisioner_options.md
CHANGED
@@ -16,6 +16,12 @@ It installs it in the following order:
|
|
16
16
|
|
17
17
|
Install require packages and then installs ansible using the python pip command and ansible version must be specified. This allows a specific version of ansible to be installed.
|
18
18
|
|
19
|
+
* if require_pip3 is set to true
|
20
|
+
|
21
|
+
Install require packages and then installs ansible using the python pip3 command and ansible version must be specified. This allows a specific version of ansible to be installed.
|
22
|
+
|
23
|
+
Currently only works for Redhat/Centos.
|
24
|
+
|
19
25
|
* if require_ansible_repo is set to true (the default)
|
20
26
|
|
21
27
|
Installs from the operation system repository only with the ansible version that is in the particular repository and will use the ansible_version in the package name where appropriate.
|
@@ -95,9 +101,11 @@ require_ansible_repo | true | Set if installing Ansible from a `yum` or `apt` re
|
|
95
101
|
require_ansible_source | false | Install Ansible from source using method described [here](http://docs.ansible.com/intro_installation.html#running-from-source). Only works on Debian/Ubuntu at present
|
96
102
|
require_chef_for_busser | true | Install Chef to run Busser for tests. NOTE: kitchen 1.4 only requires Ruby to run Busser so this is not required.
|
97
103
|
require_pip | false | Set to `true` if Ansible is to be installed through `pip`).
|
104
|
+
require_pip3 | false | Set to `true` if Ansible is to be installed through `pip3`).
|
98
105
|
require_ruby_for_busser | false | Install Ruby to run Busser for tests
|
99
106
|
require_windows_support | false | Install [Windows support](http://docs.ansible.com/ansible/intro_windows.html)
|
100
107
|
requirements_path | | Path to Ansible Galaxy requirements
|
108
|
+
requirements_collection_path | | Path to Ansible Galaxy requirements
|
101
109
|
retry_on_exit_code | [] | Array of exit codes to retry converge command against
|
102
110
|
role_name | | use when the repo name does not match the name the role is published as.
|
103
111
|
roles_path | roles | Ansible repo roles directory
|
@@ -109,6 +117,19 @@ update_package_repos | true | Update OS repository metadata
|
|
109
117
|
wait_for_retry | 30 | number of seconds to wait before retrying converge command
|
110
118
|
ignore_ansible_cfg | false | If true, values from ansible.cfg file will not be loaded.
|
111
119
|
|
120
|
+
## require_pip3
|
121
|
+
|
122
|
+
if using python 3 and wish to install via pip specify
|
123
|
+
```yaml
|
124
|
+
ansible_binary_path: /usr/local/bin
|
125
|
+
require_pip3: true
|
126
|
+
```
|
127
|
+
|
128
|
+
|
129
|
+
you must specify ansible_binary_path as well.
|
130
|
+
|
131
|
+
Currently this only works for Centos and Redhat
|
132
|
+
|
112
133
|
## Ansible Inventory
|
113
134
|
|
114
135
|
Ansible has the concept of an [inventory](http://docs.ansible.com/ansible/latest/intro_inventory.html).
|
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.
|
4
|
+
version: 0.53.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:
|
11
|
+
date: 2020-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -56,14 +56,14 @@ dependencies:
|
|
56
56
|
name: test-kitchen
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.4'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.4'
|
69
69
|
- !ruby/object:Gem::Dependency
|
@@ -124,15 +124,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
124
124
|
requirements:
|
125
125
|
- - ">="
|
126
126
|
- !ruby/object:Gem::Version
|
127
|
-
version: '
|
127
|
+
version: '0'
|
128
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
130
|
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
|
-
|
135
|
-
rubygems_version: 2.6.13
|
134
|
+
rubygems_version: 3.1.4
|
136
135
|
signing_key:
|
137
136
|
specification_version: 4
|
138
137
|
summary: ansible provisioner for test-kitchen
|