kitchen-ansible 0.45.4 → 0.45.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,69 +1,69 @@
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
- #{sudo_env('apt-get')} -y install apt-utils git
45
-
46
- ## Fix debconf tty warning messages
47
- export DEBIAN_FRONTEND=noninteractive
48
-
49
- ## 13.10, 14.04 include add-apt-repository in software-properties-common
50
- #{sudo_env('apt-get')} -y install software-properties-common
51
-
52
- ## 10.04, 12.04 include add-apt-repository in
53
- #{sudo_env('apt-get')} -y install python-software-properties
54
-
55
- ## 10.04 version of add-apt-repository doesn't accept --yes
56
- ## later versions require interaction from user, so we must specify --yes
57
- ## First try with -y flag, else if it fails, try without.
58
- ## "add-apt-repository: error: no such option: -y" is returned but is ok to ignore, we just retry
59
- #{sudo_env('add-apt-repository')} -y #{@config[:ansible_apt_repo]} || #{sudo_env('add-apt-repository')} #{@config[:ansible_apt_repo]}
60
- #{sudo_env('apt-get')} update
61
- #{sudo_env('apt-get')} -y install ansible#{ansible_debian_version}
62
- fi
63
- INSTALL
64
- end
65
- end
66
- end
67
- end
68
- end
69
- 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
+ #{sudo_env('apt-get')} -y install apt-utils git
45
+
46
+ ## Fix debconf tty warning messages
47
+ export DEBIAN_FRONTEND=noninteractive
48
+
49
+ ## 13.10, 14.04 include add-apt-repository in software-properties-common
50
+ #{sudo_env('apt-get')} -y install software-properties-common
51
+
52
+ ## 10.04, 12.04 include add-apt-repository in
53
+ #{sudo_env('apt-get')} -y install python-software-properties
54
+
55
+ ## 10.04 version of add-apt-repository doesn't accept --yes
56
+ ## later versions require interaction from user, so we must specify --yes
57
+ ## First try with -y flag, else if it fails, try without.
58
+ ## "add-apt-repository: error: no such option: -y" is returned but is ok to ignore, we just retry
59
+ #{sudo_env('add-apt-repository')} -y #{@config[:ansible_apt_repo]} || #{sudo_env('add-apt-repository')} #{@config[:ansible_apt_repo]}
60
+ #{sudo_env('apt-get')} update
61
+ #{sudo_env('apt-get')} -y install ansible#{ansible_debian_version}
62
+ fi
63
+ INSTALL
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -1,60 +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
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
@@ -1,70 +1,70 @@
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 Redhat < Os
25
- def install_command
26
- <<-INSTALL
27
-
28
- if [ ! $(which ansible) ]; then
29
- #{install_epel_repo}
30
- #{redhat_yum_repo}
31
- #{update_packages_command}
32
- #{sudo_env('yum')} -y install #{ansible_package_name} libselinux-python git
33
- fi
34
- INSTALL
35
- end
36
-
37
- def update_packages_command
38
- @config[:update_package_repos] ? "#{sudo_env('yum')} makecache" : nil
39
- end
40
-
41
- def install_epel_repo
42
- @config[:enable_yum_epel] ? sudo_env('yum install epel-release -y') : nil
43
- end
44
-
45
- def ansible_package_name
46
- if @config[:ansible_version] == 'latest' || @config[:ansible_version] == nil
47
- "ansible"
48
- else
49
- "ansible#{@config[:ansible_version][0..2]}-#{@config[:ansible_version]}"
50
- end
51
- end
52
-
53
- def redhat_yum_repo
54
- if @config[:ansible_yum_repo]
55
- <<-INSTALL
56
- #{sudo_env('rpm')} -ivh #{@config[:ansible_yum_repo]}
57
- INSTALL
58
- else
59
- <<-INSTALL
60
- if ! yum repolist epel | grep -q epel; then
61
- #{sudo_env('rpm')} -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-`rpm -E %dist | sed -n 's/.*el\\([0-9]\\).*/\\1/p'`.noarch.rpm
62
- fi
63
- INSTALL
64
- end
65
- end
66
- end
67
- end
68
- end
69
- end
70
- 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 Redhat < Os
25
+ def install_command
26
+ <<-INSTALL
27
+
28
+ if [ ! $(which ansible) ]; then
29
+ #{install_epel_repo}
30
+ #{redhat_yum_repo}
31
+ #{update_packages_command}
32
+ #{sudo_env('yum')} -y install #{ansible_package_name} libselinux-python git
33
+ fi
34
+ INSTALL
35
+ end
36
+
37
+ def update_packages_command
38
+ @config[:update_package_repos] ? "#{sudo_env('yum')} makecache" : nil
39
+ end
40
+
41
+ def install_epel_repo
42
+ @config[:enable_yum_epel] ? sudo_env('yum install epel-release -y') : nil
43
+ end
44
+
45
+ def ansible_package_name
46
+ if @config[:ansible_version] == 'latest' || @config[:ansible_version] == nil
47
+ "ansible"
48
+ else
49
+ "ansible#{@config[:ansible_version][0..2]}-#{@config[:ansible_version]}"
50
+ end
51
+ end
52
+
53
+ def redhat_yum_repo
54
+ if @config[:ansible_yum_repo]
55
+ <<-INSTALL
56
+ #{sudo_env('rpm')} -ivh #{@config[:ansible_yum_repo]}
57
+ INSTALL
58
+ else
59
+ <<-INSTALL
60
+ if ! yum repolist epel | grep -q epel; then
61
+ #{sudo_env('rpm')} -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-`rpm -E %dist | sed -n 's/.*el\\([0-9]\\).*/\\1/p'`.noarch.rpm
62
+ fi
63
+ INSTALL
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -1,44 +1,44 @@
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 Suse < Os
25
- def install_command
26
- <<-INSTALL
27
-
28
- if [ ! $(which ansible) ]; then
29
- #{sudo_env('zypper')} ar #{@config[:python_sles_repo]}
30
- #{sudo_env('zypper')} ar #{@config[:ansible_sles_repo]}
31
- #{update_packages_command}
32
- #{sudo_env('zypper')} --non-interactive install ansible
33
- fi
34
- INSTALL
35
- end
36
-
37
- def update_packages_command
38
- @config[:update_package_repos] ? "#{sudo_env('zypper')} --gpg-auto-import-keys ref" : nil
39
- end
40
- end
41
- end
42
- end
43
- end
44
- 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 Suse < Os
25
+ def install_command
26
+ <<-INSTALL
27
+
28
+ if [ ! $(which ansible) ]; then
29
+ #{sudo_env('zypper')} ar #{@config[:python_sles_repo]}
30
+ #{sudo_env('zypper')} ar #{@config[:ansible_sles_repo]}
31
+ #{update_packages_command}
32
+ #{sudo_env('zypper')} --non-interactive install ansible
33
+ fi
34
+ INSTALL
35
+ end
36
+
37
+ def update_packages_command
38
+ @config[:update_package_repos] ? "#{sudo_env('zypper')} --gpg-auto-import-keys ref" : nil
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end