kitchen-ansible 0.48.8 → 0.51.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +270 -270
- data/kitchen-ansible.gemspec +34 -35
- data/lib/kitchen-ansible/version.rb +6 -6
- data/lib/kitchen/provisioner/ansible/config.rb +199 -196
- data/lib/kitchen/provisioner/ansible/librarian.rb +78 -78
- data/lib/kitchen/provisioner/ansible/os.rb +84 -84
- data/lib/kitchen/provisioner/ansible/os/alpine.rb +42 -42
- data/lib/kitchen/provisioner/ansible/os/amazon.rb +42 -42
- data/lib/kitchen/provisioner/ansible/os/darwin.rb +37 -37
- data/lib/kitchen/provisioner/ansible/os/debian.rb +77 -75
- data/lib/kitchen/provisioner/ansible/os/fedora.rb +66 -60
- data/lib/kitchen/provisioner/ansible/os/freebsd.rb +34 -34
- data/lib/kitchen/provisioner/ansible/os/openbsd.rb +36 -36
- data/lib/kitchen/provisioner/ansible/os/redhat.rb +86 -80
- data/lib/kitchen/provisioner/ansible/os/suse.rb +44 -44
- data/lib/kitchen/provisioner/ansible_playbook.rb +1259 -1232
- data/provisioner_options.md +270 -267
- metadata +6 -7
@@ -1,37 +1,37 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
#
|
3
|
-
# Author:: Michael Heap (<m@michaelheap.com>)
|
4
|
-
#
|
5
|
-
# Copyright (C) 2015 Michael Heap
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
#
|
19
|
-
|
20
|
-
module Kitchen
|
21
|
-
module Provisioner
|
22
|
-
module Ansible
|
23
|
-
class Os
|
24
|
-
class Darwin < Os
|
25
|
-
|
26
|
-
def install_command
|
27
|
-
<<-INSTALL
|
28
|
-
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" </dev/null
|
29
|
-
/usr/local/bin/brew install ansible
|
30
|
-
INSTALL
|
31
|
-
end
|
32
|
-
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Author:: Michael Heap (<m@michaelheap.com>)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2015 Michael Heap
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
module Kitchen
|
21
|
+
module Provisioner
|
22
|
+
module Ansible
|
23
|
+
class Os
|
24
|
+
class Darwin < Os
|
25
|
+
|
26
|
+
def install_command
|
27
|
+
<<-INSTALL
|
28
|
+
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" </dev/null
|
29
|
+
/usr/local/bin/brew install ansible
|
30
|
+
INSTALL
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -1,75 +1,77 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
#
|
3
|
-
# Author:: Michael Heap (<m@michaelheap.com>)
|
4
|
-
#
|
5
|
-
# Copyright (C) 2015 Michael Heap
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
#
|
19
|
-
|
20
|
-
module Kitchen
|
21
|
-
module Provisioner
|
22
|
-
module Ansible
|
23
|
-
class Os
|
24
|
-
class Debian < Os
|
25
|
-
def update_packages_command
|
26
|
-
@config[:update_package_repos] ? "#{sudo_env('apt-get')} update" : nil
|
27
|
-
end
|
28
|
-
|
29
|
-
def ansible_debian_version
|
30
|
-
if @config[:ansible_version] == 'latest' || @config[:ansible_version] == nil
|
31
|
-
''
|
32
|
-
else
|
33
|
-
"=#{@config[:ansible_version]}"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def install_command
|
38
|
-
<<-INSTALL
|
39
|
-
|
40
|
-
if [ ! $(which ansible) ]; then
|
41
|
-
#{update_packages_command}
|
42
|
-
|
43
|
-
## Install apt-utils to silence debconf warning: http://serverfault.com/q/358943/77156
|
44
|
-
## Install dirmngr to handle GPG key management for stretch, addressing https://github.com/neillturner/kitchen-ansible/issues/257
|
45
|
-
#{sudo_env('apt-get')} -y install apt-utils git dirmngr
|
46
|
-
|
47
|
-
## Fix debconf tty warning messages
|
48
|
-
export DEBIAN_FRONTEND=noninteractive
|
49
|
-
|
50
|
-
if [ -f /etc/os-release ] && [ `grep 'ID=debian' /etc/os-release` ]; then
|
51
|
-
#{sudo_env('echo')} "deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main" | sudo tee -a /etc/apt/sources.list
|
52
|
-
#{sudo_env('apt-key')} adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
|
53
|
-
else
|
54
|
-
## 13.10, 14.04 include add-apt-repository in software-properties-common
|
55
|
-
#{sudo_env('apt-get')} -y install software-properties-common
|
56
|
-
|
57
|
-
## 10.04, 12.04 include add-apt-repository in
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
##
|
63
|
-
##
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
end
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Author:: Michael Heap (<m@michaelheap.com>)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2015 Michael Heap
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
module Kitchen
|
21
|
+
module Provisioner
|
22
|
+
module Ansible
|
23
|
+
class Os
|
24
|
+
class Debian < Os
|
25
|
+
def update_packages_command
|
26
|
+
@config[:update_package_repos] ? "#{sudo_env('apt-get')} update" : nil
|
27
|
+
end
|
28
|
+
|
29
|
+
def ansible_debian_version
|
30
|
+
if @config[:ansible_version] == 'latest' || @config[:ansible_version] == nil
|
31
|
+
''
|
32
|
+
else
|
33
|
+
"=#{@config[:ansible_version]}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def install_command
|
38
|
+
<<-INSTALL
|
39
|
+
|
40
|
+
if [ ! $(which ansible) ]; then
|
41
|
+
#{update_packages_command}
|
42
|
+
|
43
|
+
## Install apt-utils to silence debconf warning: http://serverfault.com/q/358943/77156
|
44
|
+
## Install dirmngr to handle GPG key management for stretch, addressing https://github.com/neillturner/kitchen-ansible/issues/257
|
45
|
+
#{sudo_env('apt-get')} -y install apt-utils git dirmngr
|
46
|
+
|
47
|
+
## Fix debconf tty warning messages
|
48
|
+
export DEBIAN_FRONTEND=noninteractive
|
49
|
+
|
50
|
+
if [ -f /etc/os-release ] && [ `grep 'ID=debian' /etc/os-release` ]; then
|
51
|
+
#{sudo_env('echo')} "deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main" | sudo tee -a /etc/apt/sources.list
|
52
|
+
#{sudo_env('apt-key')} adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
|
53
|
+
else
|
54
|
+
## 13.10, 14.04 include add-apt-repository in software-properties-common
|
55
|
+
#{sudo_env('apt-get')} -y install software-properties-common
|
56
|
+
|
57
|
+
## 10.04, 12.04 include add-apt-repository in
|
58
|
+
if [apt-cache pkgnames | grep -q 'python-software-properties']; then
|
59
|
+
#{sudo_env('apt-get')} -y install python-software-properties
|
60
|
+
fi
|
61
|
+
|
62
|
+
## 10.04 version of add-apt-repository doesn't accept --yes
|
63
|
+
## later versions require interaction from user, so we must specify --yes
|
64
|
+
## First try with -y flag, else if it fails, try without.
|
65
|
+
## "add-apt-repository: error: no such option: -y" is returned but is ok to ignore, we just retry
|
66
|
+
#{sudo_env('add-apt-repository')} -y #{@config[:ansible_apt_repo]} || #{sudo_env('add-apt-repository')} #{@config[:ansible_apt_repo]}
|
67
|
+
fi
|
68
|
+
#{sudo_env('apt-get')} update
|
69
|
+
#{sudo_env('apt-get')} -y install ansible#{ansible_debian_version}
|
70
|
+
fi
|
71
|
+
INSTALL
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -1,60 +1,66 @@
|
|
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
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
end
|
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
|
+
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
|
39
|
+
fi
|
40
|
+
INSTALL
|
41
|
+
end
|
42
|
+
|
43
|
+
def update_packages_command
|
44
|
+
@config[:update_package_repos] ? "#{sudo_env('dnf')} makecache" : nil
|
45
|
+
end
|
46
|
+
|
47
|
+
def ansible_package_name
|
48
|
+
if @config[:ansible_version] == 'latest' || @config[:ansible_version] == nil
|
49
|
+
"ansible"
|
50
|
+
else
|
51
|
+
"ansible#{@config[:ansible_version][0..2]}-#{@config[:ansible_version]}"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def redhat_yum_repo
|
56
|
+
if @config[:ansible_yum_repo]
|
57
|
+
<<-INSTALL
|
58
|
+
#{sudo_env('rpm')} -ivh #{@config[:ansible_yum_repo]}
|
59
|
+
INSTALL
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -1,34 +1,34 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
#
|
3
|
-
# Author:: Tomoyuki Sakurai
|
4
|
-
#
|
5
|
-
# Copyright (C) 2018 Tomoyuki Sakurai
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
#
|
19
|
-
|
20
|
-
module Kitchen
|
21
|
-
module Provisioner
|
22
|
-
module Ansible
|
23
|
-
class Os
|
24
|
-
class Freebsd < Os
|
25
|
-
def install_command
|
26
|
-
<<-INSTALL
|
27
|
-
pkg install -y ansible
|
28
|
-
INSTALL
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Author:: Tomoyuki Sakurai
|
4
|
+
#
|
5
|
+
# Copyright (C) 2018 Tomoyuki Sakurai
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
module Kitchen
|
21
|
+
module Provisioner
|
22
|
+
module Ansible
|
23
|
+
class Os
|
24
|
+
class Freebsd < Os
|
25
|
+
def install_command
|
26
|
+
<<-INSTALL
|
27
|
+
pkg install -y ansible
|
28
|
+
INSTALL
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -1,36 +1,36 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
#
|
3
|
-
# Author:: Marcin Wolny (<marcin@wutanic.com>)
|
4
|
-
#
|
5
|
-
# Copyright (C) 2015 Marcin Wolny
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
#
|
19
|
-
|
20
|
-
module Kitchen
|
21
|
-
module Provisioner
|
22
|
-
module Ansible
|
23
|
-
class Os
|
24
|
-
class Openbsd < Os
|
25
|
-
|
26
|
-
def install_command
|
27
|
-
<<-INSTALL
|
28
|
-
sudo pkg_add ansible--
|
29
|
-
INSTALL
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Author:: Marcin Wolny (<marcin@wutanic.com>)
|
4
|
+
#
|
5
|
+
# Copyright (C) 2015 Marcin Wolny
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
module Kitchen
|
21
|
+
module Provisioner
|
22
|
+
module Ansible
|
23
|
+
class Os
|
24
|
+
class Openbsd < Os
|
25
|
+
|
26
|
+
def install_command
|
27
|
+
<<-INSTALL
|
28
|
+
sudo pkg_add ansible--
|
29
|
+
INSTALL
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|