kitchen-ansible 0.47.5 → 0.48.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 +8 -1
- data/lib/kitchen-ansible/version.rb +1 -1
- data/lib/kitchen/provisioner/ansible/os.rb +3 -0
- data/lib/kitchen/provisioner/ansible/os/darwin.rb +1 -1
- data/lib/kitchen/provisioner/ansible/os/openbsd.rb +36 -0
- data/lib/kitchen/provisioner/ansible/os/redhat.rb +13 -3
- data/lib/kitchen/provisioner/ansible_playbook.rb +2 -0
- data/provisioner_options.md +63 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3000b4a33dd946e4d64314ffad1c930373e1217f
|
4
|
+
data.tar.gz: 9f819154af5b31230a5a086072b3d7a80d8846ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b51e9f86170bb3e3eeb0522e27381b8335a851666243267fee6cbe72154bb5829d3ea7fb7d0522d80004bee8e18528c4711b666364f4093e4caca1b236439a1
|
7
|
+
data.tar.gz: 4fdec37b3da4fd7db358800bcaf31bb0af5817865ace15e476e950cc6b811db714c4b8bbbe59912fb6402160e9618ad29d8dfdf2c7a6a43b4a6194a4638074ae
|
data/README.md
CHANGED
@@ -17,7 +17,14 @@ It has been tested against the Ubuntu 12.04/14.04/16.04, Centos 6/7 and Debian 6
|
|
17
17
|
- a driver box without a Chef installation so Ansible can be installed.
|
18
18
|
|
19
19
|
## Installation & Setup
|
20
|
-
|
20
|
+
|
21
|
+
1. install the latest Ruby on your workstations (for windows see https://rubyinstaller.org/downloads/)
|
22
|
+
|
23
|
+
2. If using Ruby version less than 2.3 first install earlier version of test-kitchen
|
24
|
+
```
|
25
|
+
gem install test-kitchen -v 1.16.0
|
26
|
+
```
|
27
|
+
3. Install the `kitchen-ansible` gem in your system, along with [kitchen-vagrant](https://github.com/test-kitchen/kitchen-vagrant) or [kitchen-docker](https://github.com/test-kitchen/kitchen-docker) or any other suitable driver:
|
21
28
|
|
22
29
|
```
|
23
30
|
gem install kitchen-ansible
|
@@ -25,6 +25,7 @@ require 'kitchen/provisioner/ansible/os/amazon'
|
|
25
25
|
require 'kitchen/provisioner/ansible/os/suse'
|
26
26
|
require 'kitchen/provisioner/ansible/os/darwin'
|
27
27
|
require 'kitchen/provisioner/ansible/os/alpine'
|
28
|
+
require 'kitchen/provisioner/ansible/os/openbsd'
|
28
29
|
|
29
30
|
module Kitchen
|
30
31
|
module Provisioner
|
@@ -55,6 +56,8 @@ module Kitchen
|
|
55
56
|
return Darwin.new(platform, config)
|
56
57
|
when 'alpine'
|
57
58
|
return Alpine.new(platform, config)
|
59
|
+
when 'openbsd'
|
60
|
+
return Openbsd.new(platform, config)
|
58
61
|
end
|
59
62
|
|
60
63
|
nil
|
@@ -25,7 +25,7 @@ module Kitchen
|
|
25
25
|
|
26
26
|
def install_command
|
27
27
|
<<-INSTALL
|
28
|
-
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
28
|
+
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" </dev/null
|
29
29
|
/usr/local/bin/brew install ansible
|
30
30
|
INSTALL
|
31
31
|
end
|
@@ -0,0 +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
|
@@ -42,11 +42,21 @@ module Kitchen
|
|
42
42
|
@config[:enable_yum_epel] ? sudo_env('yum install epel-release -y') : nil
|
43
43
|
end
|
44
44
|
|
45
|
+
def ansible_package_version_suffix
|
46
|
+
return unless @config[:ansible_version] && @config[:ansible_version] != 'latest'
|
47
|
+
|
48
|
+
if @config[:ansible_package_name]
|
49
|
+
"-#{@config[:ansible_version]}"
|
50
|
+
else
|
51
|
+
"#{@config[:ansible_version][0..2]}-#{@config[:ansible_version]}"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
45
55
|
def ansible_package_name
|
46
|
-
if @config[:
|
47
|
-
"
|
56
|
+
if @config[:ansible_package_name]
|
57
|
+
"#{@config[:ansible_package_name]}#{ansible_package_version_suffix}"
|
48
58
|
else
|
49
|
-
"ansible#{
|
59
|
+
"ansible#{ansible_package_version_suffix}"
|
50
60
|
end
|
51
61
|
end
|
52
62
|
|
@@ -97,6 +97,8 @@ module Kitchen
|
|
97
97
|
#{Kitchen::Provisioner::Ansible::Os::Darwin.new('darwin', config).install_command}
|
98
98
|
elif [ -f /etc/alpine-release ] || [ -d /etc/apk ]; then
|
99
99
|
#{Kitchen::Provisioner::Ansible::Os::Alpine.new('alpine', config).install_command}
|
100
|
+
elif [ $(uname -s) = "OpenBSD" ]; then
|
101
|
+
#{Kitchen::Provisioner::Ansible::Os::Openbsd.new('openbsd', config).install_command}
|
100
102
|
else
|
101
103
|
#{Kitchen::Provisioner::Ansible::Os::Debian.new('debian', config).install_command}
|
102
104
|
fi
|
data/provisioner_options.md
CHANGED
@@ -19,6 +19,8 @@ It installs it in the following order:
|
|
19
19
|
* if require_ansible_repo is set to true (the default)
|
20
20
|
|
21
21
|
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
|
+
|
23
|
+
NOTE: Set to ansible_package_name to 'ansible' when installing from the CentOS/Redhat extras repo, instead of the EPEL.
|
22
24
|
|
23
25
|
# Provisioner Options
|
24
26
|
|
@@ -41,6 +43,7 @@ ansible_inventory | | Static or dynamic inventory file or directory or 'none' i
|
|
41
43
|
ansible_limit | | Further limits the selected host/group patterns
|
42
44
|
ansible_omnibus_remote_path | /opt/ansible | Server installation location of an Omnibus Ansible install
|
43
45
|
ansible_omnibus_url | `https://raw.githubusercontent.com` `/neillturner/omnibus-ansible` `/master/ansible_install.sh` | Omnibus Ansible install location
|
46
|
+
ansible_package_name | | Set to ansible when installing from the CentOS/Redhat extras repo, instead of the EPEL.
|
44
47
|
ansible_platform | Naively tries to determine | OS platform of server
|
45
48
|
ansible_playbook_command | | Override the Ansible playbook command
|
46
49
|
ansible_sles_repo | `http://download.opensuse.org/repositories` `/systemsmanagement/SLE_12` `/systemsmanagement.repo` | Zypper SuSE Ansible repo
|
@@ -100,6 +103,66 @@ sudo_command | sudo -E | `sudo` command; change to `sudo -E -H` to be consistent
|
|
100
103
|
update_package_repos | true | Update OS repository metadata
|
101
104
|
wait_for_retry | 30 | number of seconds to wait before retrying converge command
|
102
105
|
|
106
|
+
## Ansible Inventory
|
107
|
+
|
108
|
+
Ansible has the concept of an [inventory](http://docs.ansible.com/ansible/latest/intro_inventory.html).
|
109
|
+
|
110
|
+
Ansible then connects to these servers and processes the playbook against the server.
|
111
|
+
|
112
|
+
See also [Host inventories](https://ansible-tips-and-tricks.readthedocs.io/en/latest/ansible/inventory/).
|
113
|
+
|
114
|
+
|
115
|
+
### ansible Inventory parameter
|
116
|
+
|
117
|
+
if you have an ansible inventory file you can specify it in the ansible_inventory parameter in the .kitchen.yml file.
|
118
|
+
```yaml
|
119
|
+
ansible_inventory: myinventoryfile.txt
|
120
|
+
```
|
121
|
+
or if you have an ansible.cfg file specify
|
122
|
+
```yaml
|
123
|
+
ansible_inventory: none
|
124
|
+
```
|
125
|
+
it will look for the file in the root of your repository.
|
126
|
+
|
127
|
+
or it can be a directory from the root of your repository and contain scripts to implement [dynamic inventory](http://docs.ansible.com/ansible/latest/intro_dynamic_inventory.html)
|
128
|
+
|
129
|
+
### hosts parameter
|
130
|
+
|
131
|
+
if you don't specify an inventory file then you must specify the hosts parameter in the .kitchen.yml file.
|
132
|
+
|
133
|
+
kitchen ansible uses this information to create a hosts file that is used by ansible with the ansible command is run.
|
134
|
+
|
135
|
+
it can either be a name of a single server
|
136
|
+
|
137
|
+
```yaml
|
138
|
+
hosts: myhost
|
139
|
+
```
|
140
|
+
|
141
|
+
or any array of hosts:
|
142
|
+
|
143
|
+
```yaml
|
144
|
+
hosts:
|
145
|
+
- myhost1
|
146
|
+
- myhost2
|
147
|
+
```
|
148
|
+
|
149
|
+
the hosts file that is generated always contains in the first line
|
150
|
+
|
151
|
+
```yaml
|
152
|
+
localhost ansible_connection=local
|
153
|
+
```
|
154
|
+
so that it will process against the locahost.
|
155
|
+
|
156
|
+
and it will create a hosts file that includes the hosts you specify
|
157
|
+
|
158
|
+
```yaml
|
159
|
+
localhost ansible_connection=local
|
160
|
+
myhost1
|
161
|
+
myhost2
|
162
|
+
localhost
|
163
|
+
```
|
164
|
+
|
165
|
+
|
103
166
|
## Copying Additional Files
|
104
167
|
|
105
168
|
Several parameters have been developed rather organically to support the requirement to copy additional files beyond the ones in the standard ansible locations.
|
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.48.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: 2017-
|
11
|
+
date: 2017-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -106,6 +106,7 @@ files:
|
|
106
106
|
- lib/kitchen/provisioner/ansible/os/darwin.rb
|
107
107
|
- lib/kitchen/provisioner/ansible/os/debian.rb
|
108
108
|
- lib/kitchen/provisioner/ansible/os/fedora.rb
|
109
|
+
- lib/kitchen/provisioner/ansible/os/openbsd.rb
|
109
110
|
- lib/kitchen/provisioner/ansible/os/redhat.rb
|
110
111
|
- lib/kitchen/provisioner/ansible/os/suse.rb
|
111
112
|
- lib/kitchen/provisioner/ansible_playbook.rb
|