kitchen-ansible 0.51.0 → 0.56.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kitchen-ansible/version.rb +1 -1
- data/lib/kitchen/provisioner/ansible/config.rb +9 -2
- data/lib/kitchen/provisioner/ansible/os/amazon.rb +12 -4
- data/lib/kitchen/provisioner/ansible/os/debian.rb +5 -1
- data/lib/kitchen/provisioner/ansible_playbook.rb +53 -5
- data/provisioner_options.md +38 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb3c0e10d572c5db59b9d6ecc8be05c0b62f227beb977f68b8c8b6b5e261a5f4
|
4
|
+
data.tar.gz: d33c5a241fab596f8dd4f849a2b5784eaac33d04ae3711a8cd8d1ff068ee9151
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3981c30637f136f8441b6644b0845a63e8cd6d8e7e9194079712525e38f7b905e14a47d52e191bebcc378c8574b1d1a38428a9d7ce4e7435affaeacfa0d70dab
|
7
|
+
data.tar.gz: 701f3281bdf9c5d6fc1346f0523221efc36e911385bd0cbe6657b38d7544f0fbf6e4ae928f726bf06e4fea1ffaeb6bf060e4943d2c45220b6c8f750b94598d20
|
@@ -44,8 +44,8 @@ module Kitchen
|
|
44
44
|
default_config :tags, []
|
45
45
|
default_config :ansible_apt_repo, 'ppa:ansible/ansible'
|
46
46
|
default_config :ansible_yum_repo, nil
|
47
|
-
default_config :ansible_sles_repo, 'http://download.opensuse.org/repositories/systemsmanagement/
|
48
|
-
default_config :python_sles_repo, 'http://download.opensuse.org/repositories/devel:/languages:/python/
|
47
|
+
default_config :ansible_sles_repo, 'http://download.opensuse.org/repositories/systemsmanagement/openSUSE_Leap_15.2/systemsmanagement.repo'
|
48
|
+
default_config :python_sles_repo, 'http://download.opensuse.org/repositories/devel:/languages:/python/openSUSE_Leap_15.2/devel:languages:python.repo'
|
49
49
|
default_config :chef_bootstrap_url, 'https://www.chef.io/chef/install.sh'
|
50
50
|
# Providing we have Ruby >= 2.0 we only need Ruby. Leaving default to install Chef Omnibus for backwards compatibility.
|
51
51
|
# Note: if using kitchen-verifer-serverspec your we can avoid needing Ruby too.
|
@@ -54,6 +54,7 @@ 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
|
58
59
|
default_config :requirements_collection_path, false
|
59
60
|
default_config :ssh_known_hosts, nil
|
@@ -104,6 +105,12 @@ module Kitchen
|
|
104
105
|
fail('No roles_path detected. Please specify one in .kitchen.yml')
|
105
106
|
end
|
106
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
|
+
|
107
114
|
default_config :group_vars_path do |provisioner|
|
108
115
|
provisioner.calculate_path('group_vars', :directory)
|
109
116
|
end
|
@@ -28,10 +28,18 @@ module Kitchen
|
|
28
28
|
if [ ! $(which ansible) ]; then
|
29
29
|
#{install_epel_repo}
|
30
30
|
#{sudo_env('yum-config-manager')} --enable epel/x86_64
|
31
|
-
#{sudo_env('yum')} -y install
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
#{sudo_env('yum')} -y install git
|
32
|
+
|
33
|
+
if `grep -q "Amazon Linux AMI" /etc/os-release`; then
|
34
|
+
## Amazon Linux 1
|
35
|
+
#{sudo_env('yum')} -y install #{ansible_package_name}
|
36
|
+
#{sudo_env('alternatives')} --set python /usr/bin/python2.6
|
37
|
+
#{sudo_env('yum')} clean all
|
38
|
+
#{sudo_env('yum')} install yum-python26 -y
|
39
|
+
else
|
40
|
+
## Amazon Linux 2
|
41
|
+
#{sudo_env('amazon-linux-extras')} install -y ansible2
|
42
|
+
fi
|
35
43
|
fi
|
36
44
|
INSTALL
|
37
45
|
end
|
@@ -63,7 +63,11 @@ module Kitchen
|
|
63
63
|
## later versions require interaction from user, so we must specify --yes
|
64
64
|
## First try with -y flag, else if it fails, try without.
|
65
65
|
## "add-apt-repository: error: no such option: -y" is returned but is ok to ignore, we just retry
|
66
|
-
|
66
|
+
## There is no official Ubuntu 20.04 ansible release in the ppa, but Ubuntu has a package with the latest 2.9 Ansible
|
67
|
+
## This "fixes" issue #321 for now
|
68
|
+
if ! `grep -q 'VERSION_ID=\"20.04\"' /etc/os-release`; then
|
69
|
+
#{sudo_env('add-apt-repository')} -y #{@config[:ansible_apt_repo]} || #{sudo_env('add-apt-repository')} #{@config[:ansible_apt_repo]}
|
70
|
+
fi
|
67
71
|
fi
|
68
72
|
#{sudo_env('apt-get')} update
|
69
73
|
#{sudo_env('apt-get')} -y install ansible#{ansible_debian_version}
|
@@ -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}")
|
@@ -87,7 +90,7 @@ module Kitchen
|
|
87
90
|
if [ ! $(which ansible) ]; then
|
88
91
|
if [ -f /etc/fedora-release ]; then
|
89
92
|
#{Kitchen::Provisioner::Ansible::Os::Fedora.new('fedora', config).install_command}
|
90
|
-
elif [ -f /etc/system-release ] &&
|
93
|
+
elif [ -f /etc/system-release ] && `grep -q 'Amazon Linux' /etc/system-release`; then
|
91
94
|
#{Kitchen::Provisioner::Ansible::Os::Amazon.new('amazon', config).install_command}
|
92
95
|
elif [ -f /etc/centos-release ] || [ -f /etc/redhat-release ]; then
|
93
96
|
#{Kitchen::Provisioner::Ansible::Os::Redhat.new('redhat', config).install_command}
|
@@ -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 << [
|
@@ -540,9 +543,13 @@ module Kitchen
|
|
540
543
|
<<-INSTALL
|
541
544
|
if [ ! $(which ansible) ]; then
|
542
545
|
if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ]; then
|
546
|
+
EL_RELEASE=$(rpm -E %{rhel})
|
547
|
+
if [ "${EL_RELEASE}" -ge 8 ]; then
|
548
|
+
echo "*** Redhat/Centos 8 does not support pip2 with kitchen-ansible ***"
|
549
|
+
fi
|
543
550
|
#{Kitchen::Provisioner::Ansible::Os::Redhat.new('redhat', config).install_epel_repo}
|
544
551
|
#{update_packages_redhat_cmd} > #{detect_debug}
|
545
|
-
#{sudo_env('yum')} -y install libselinux-python python2-devel git python-setuptools
|
552
|
+
#{sudo_env('yum')} -y install libselinux-python python2-devel git python-setuptools libffi-devel openssl-devel gcc > #{detect_debug}
|
546
553
|
else
|
547
554
|
if [ -f /etc/SUSE-brand ] || [ -f /etc/SuSE-release ]; then
|
548
555
|
#{sudo_env('zypper')} ar #{python_sles_repo} > #{detect_debug}
|
@@ -555,13 +562,45 @@ module Kitchen
|
|
555
562
|
fi
|
556
563
|
|
557
564
|
#{export_http_proxy}
|
558
|
-
#{sudo_env('
|
565
|
+
#{sudo_env('curl')} 'https://bootstrap.pypa.io/pip/2.7/get-pip.py' -o 'get-pip.py' > #{detect_debug}
|
566
|
+
#{sudo_env('python')} 'get-pip.py' > #{detect_debug}
|
559
567
|
#{sudo_env('pip')} install -U setuptools > #{detect_debug}
|
560
568
|
#{sudo_env('pip')} install ansible#{ansible_version} > #{detect_debug}
|
561
569
|
fi
|
562
570
|
INSTALL
|
563
571
|
end
|
564
572
|
|
573
|
+
def install_ansible_from_pip3_command
|
574
|
+
if config[:ansible_version]=='latest' or config[:ansible_version].nil?
|
575
|
+
ansible_version = ''
|
576
|
+
else
|
577
|
+
ansible_version = "==#{config[:ansible_version]}"
|
578
|
+
end
|
579
|
+
<<-INSTALL
|
580
|
+
if [ ! $(which ansible) ]; then
|
581
|
+
if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ]; then
|
582
|
+
#{Kitchen::Provisioner::Ansible::Os::Redhat.new('redhat', config).install_epel_repo}
|
583
|
+
#{update_packages_redhat_cmd} > #{detect_debug}
|
584
|
+
#{sudo_env('yum')} -y install python3-libselinux python3-devel python3-pip git libffi-devel openssl-devel gcc > #{detect_debug}
|
585
|
+
else
|
586
|
+
if [ -f /etc/SUSE-brand ] || [ -f /etc/SuSE-release ]; then
|
587
|
+
#{sudo_env('zypper')} ar #{python_sles_repo} > #{detect_debug}
|
588
|
+
#{update_packages_suse_cmd} > #{detect_debug}
|
589
|
+
#{sudo_env('zypper')} --non-interactive install python3 python3-pip python3-setuptools python-devel git python-six libyaml-devel libffi-devel libopenssl-devel > #{detect_debug}
|
590
|
+
else
|
591
|
+
#{update_packages_debian_cmd} > #{detect_debug}
|
592
|
+
#{sudo_env('apt-get')} -y install git python3 python3-pip python3-setuptools build-essential python3-dev libffi-dev libssl-dev > #{detect_debug}
|
593
|
+
fi
|
594
|
+
fi
|
595
|
+
|
596
|
+
#{export_http_proxy}
|
597
|
+
#{sudo_env('python3')} -m pip install --upgrade pip > #{detect_debug}
|
598
|
+
#{sudo_env('pip3')} install -U setuptools > #{detect_debug}
|
599
|
+
#{sudo_env('pip3')} install ansible#{ansible_version} > #{detect_debug}
|
600
|
+
fi
|
601
|
+
INSTALL
|
602
|
+
end
|
603
|
+
|
565
604
|
def install_omnibus_command
|
566
605
|
info('Installing ansible using ansible omnibus')
|
567
606
|
|
@@ -855,7 +894,16 @@ module Kitchen
|
|
855
894
|
|
856
895
|
def extra_vars_file
|
857
896
|
return nil if config[:extra_vars_file].nil?
|
858
|
-
bash_extra_vars =
|
897
|
+
bash_extra_vars = ''
|
898
|
+
if config[:extra_vars_file].is_a?(String)
|
899
|
+
bash_extra_vars = "-e '\@#{config[:extra_vars_file]}'"
|
900
|
+
elsif config[:extra_vars_file].is_a?(Array)
|
901
|
+
config[:extra_vars_file].each { |x|
|
902
|
+
info("Adding -e '\@#{x}'")
|
903
|
+
bash_extra_vars += " -e '\@#{x}'"
|
904
|
+
}
|
905
|
+
end
|
906
|
+
|
859
907
|
debug(bash_extra_vars)
|
860
908
|
bash_extra_vars
|
861
909
|
end
|
data/provisioner_options.md
CHANGED
@@ -16,12 +16,33 @@ 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.
|
22
28
|
|
23
29
|
NOTE: Set to ansible_package_name to 'ansible' when installing from the CentOS/Redhat extras repo, instead of the EPEL.
|
24
30
|
|
31
|
+
# Install Options Maxtrix
|
32
|
+
|
33
|
+
Install options require_XXXX parameter by operation system
|
34
|
+
|
35
|
+
OS | repo | pip | pip3 | ansible_source | ansible_omnibus
|
36
|
+
---|------|-----|------|----------------|----------------
|
37
|
+
centos-72 | YES | YES | YES | NO | YES
|
38
|
+
centos-8 | YES | NO | YES | NO | NO
|
39
|
+
ubuntu-1604 | YES | YES | NO | NO | YES
|
40
|
+
ubuntu-2004 | YES | NO | YES | NO | YES
|
41
|
+
debian-9 | YES | YES | YES | NO | YES
|
42
|
+
debian-10 | YES | YES | YES | NO | YES
|
43
|
+
suse-15 | YES | YES | YES | NO | NO
|
44
|
+
alpine-38 | UNTESTED | NO | NO | NO | NO
|
45
|
+
|
25
46
|
# Provisioner Options
|
26
47
|
|
27
48
|
kitchen-ansible runs the ansible playbook command http://linux.die.net/man/1/ansible-playbook with options from parameters in the kitchen.yml file:
|
@@ -47,7 +68,7 @@ ansible_omnibus_url | `https://raw.githubusercontent.com` `/neillturner/omnibus-
|
|
47
68
|
ansible_package_name | | Set to ansible when installing from the CentOS/Redhat extras repo, instead of the EPEL.
|
48
69
|
ansible_platform | Naively tries to determine | OS platform of server
|
49
70
|
ansible_playbook_command | | Override the Ansible playbook command
|
50
|
-
ansible_sles_repo | `http://download.opensuse.org/repositories` `/systemsmanagement/
|
71
|
+
ansible_sles_repo | `http://download.opensuse.org/repositories` `/systemsmanagement/openSUSE_Leap_15.2` `/systemsmanagement.repo` | Zypper SuSE Ansible repo
|
51
72
|
ansible_source_url | `git://github.com/ansible/ansible.git` | Git URL of Ansible source
|
52
73
|
ansible_source_rev | | Branch or tag to install Ansible source
|
53
74
|
ansible_sudo | true | Determines whether `ansible-playbook` is executed as root or as the current authenticated user
|
@@ -66,7 +87,7 @@ custom_post_play_command | nil | Custom shell command to be used after the ansib
|
|
66
87
|
enable_yum_epel | false | Enable the `yum` EPEL repo
|
67
88
|
env_vars | Hash.new | Hash to set environment variable to use with `ansible-playbook` command
|
68
89
|
extra_vars | Hash.new | Hash to set the `extra_vars` passed to `ansible-playbook` command
|
69
|
-
extra_vars_file | nil |
|
90
|
+
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.
|
70
91
|
filter_plugins_path | filter_plugins | Ansible repo `filter_plugins` directory
|
71
92
|
galaxy_ignore_certs | false | Ignore certificate errors when installing roles with ansible-galaxy.
|
72
93
|
group_vars_path | group_vars | Ansible repo group_vars directory
|
@@ -88,13 +109,14 @@ modules_path | | Ansible repo manifests directory
|
|
88
109
|
no_proxy | nil | List of URLs or IPs that should be excluded from proxying
|
89
110
|
playbook | default.yml | Playbook for `ansible-playbook` to run
|
90
111
|
private_key | | ssh private key file for ssh connection
|
91
|
-
python_sles_repo | `http://download.opensuse.org/repositories` `/devel:/languages:/python/
|
112
|
+
python_sles_repo | `http://download.opensuse.org/repositories` `/devel:/languages:/python/openSUSE_Leap_15.2` `/devel:languages:python.repo` | Zypper SuSE python repo
|
92
113
|
recursive_additional_copy_path | | Arbitrary array of files and directories to copy into test environment. See below section Copying Additional Files
|
93
114
|
require_ansible_omnibus | false | Set to `true` if using Omnibus Ansible `pip` install
|
94
115
|
require_ansible_repo | true | Set if installing Ansible from a `yum` or `apt` repo
|
95
116
|
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
117
|
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
118
|
require_pip | false | Set to `true` if Ansible is to be installed through `pip`).
|
119
|
+
require_pip3 | false | Set to `true` if Ansible is to be installed through `pip3`).
|
98
120
|
require_ruby_for_busser | false | Install Ruby to run Busser for tests
|
99
121
|
require_windows_support | false | Install [Windows support](http://docs.ansible.com/ansible/intro_windows.html)
|
100
122
|
requirements_path | | Path to Ansible Galaxy requirements
|
@@ -110,6 +132,19 @@ update_package_repos | true | Update OS repository metadata
|
|
110
132
|
wait_for_retry | 30 | number of seconds to wait before retrying converge command
|
111
133
|
ignore_ansible_cfg | false | If true, values from ansible.cfg file will not be loaded.
|
112
134
|
|
135
|
+
## require_pip3
|
136
|
+
|
137
|
+
if using python 3 and wish to install via pip specify
|
138
|
+
```yaml
|
139
|
+
ansible_binary_path: /usr/local/bin
|
140
|
+
require_pip3: true
|
141
|
+
```
|
142
|
+
|
143
|
+
|
144
|
+
you must specify ansible_binary_path as well.
|
145
|
+
|
146
|
+
Currently this only works for Centos and Redhat
|
147
|
+
|
113
148
|
## Ansible Inventory
|
114
149
|
|
115
150
|
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.56.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: 2021-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
|
-
rubygems_version: 3.
|
134
|
+
rubygems_version: 3.1.4
|
135
135
|
signing_key:
|
136
136
|
specification_version: 4
|
137
137
|
summary: ansible provisioner for test-kitchen
|