kitchen-ansiblepush 0.6.2 → 0.7.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 +29 -21
- data/lib/kitchen/provisioner/ansible_push.rb +2 -2
- data/lib/kitchen-ansible/util_inventory.rb +6 -3
- data/lib/kitchen-ansible/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 297f186b8f310c5a3c0cf16906feaa6f6dd02a6b
|
4
|
+
data.tar.gz: 0a6377640cb723d276dd887e27d4be1c9bc05e7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87d3fd01c7dfe4c736afd686c0ec8fbf494d11111ecc4cac34b43ced36db24a7db20fc62df300fc6e37bc3b5c4e77cbb4919cb5139ec70b1b0e59bd04684e26c
|
7
|
+
data.tar.gz: 30409beed3538e0eb0eb74448098e2af9eee1372bbec6b765c456c99e6f30a5422f658bcd524d8754f5b49b591fed363020205e7bb823977f07955f026e1976e
|
data/README.md
CHANGED
@@ -3,27 +3,16 @@
|
|
3
3
|
[![Gem Downloads](http://ruby-gem-downloads-badge.herokuapp.com/kitchen-ansiblepush?type=total&color=brightgreen)](https://rubygems.org/gems/kitchen-ansiblepush)
|
4
4
|
[![Build Status](https://travis-ci.org/ahelal/kitchen-ansiblepush.svg?branch=master)](https://travis-ci.org/ahelal/kitchen-ansiblepush)
|
5
5
|
|
6
|
-
A test-kitchen plugin that adds the support for ansible in push mode
|
6
|
+
A test-kitchen plugin that adds the support for ansible in push mode i.e. normal mode :)
|
7
7
|
|
8
8
|
## Intro
|
9
|
-
This kitchen plugin adds ansible as a provisioner in push mode. Ansible will run from your host rather than run from guest
|
9
|
+
This kitchen plugin adds ansible as a provisioner in push mode. Ansible will run from your host rather than run from guest instance(s). That also means your code will not be copied to guest.
|
10
10
|
|
11
|
-
|
11
|
+
It is designed to just simply work with minimum configuration. Just run as you would normaly do.
|
12
12
|
|
13
|
-
|
14
|
-
```
|
15
|
-
gem install kitchen-ansiblepush
|
16
|
-
```
|
17
|
-
|
18
|
-
### To install from code
|
19
|
-
```
|
20
|
-
git clone git@github.com:ahelal/kitchen-ansiblepush.git
|
21
|
-
cd kitchen-ansiblepush
|
22
|
-
gem build kitchen-ansiblepush.gemspec
|
23
|
-
gem install kitchen-ansiblepush-<version>.gem
|
24
|
-
```
|
13
|
+
## How to install
|
25
14
|
|
26
|
-
### Use Bundler
|
15
|
+
### (1) Use Bundler
|
27
16
|
My preferred method is use Gemfile
|
28
17
|
|
29
18
|
```ruby
|
@@ -35,6 +24,19 @@ group :development do
|
|
35
24
|
end
|
36
25
|
```
|
37
26
|
|
27
|
+
### (2) Ruby gem
|
28
|
+
```bash
|
29
|
+
gem install kitchen-ansiblepush
|
30
|
+
```
|
31
|
+
|
32
|
+
### (3) Install from code
|
33
|
+
```bash
|
34
|
+
git clone git@github.com:ahelal/kitchen-ansiblepush.git
|
35
|
+
cd kitchen-ansiblepush
|
36
|
+
gem build kitchen-ansiblepush.gemspec
|
37
|
+
gem install kitchen-ansiblepush-<version>.gem
|
38
|
+
```
|
39
|
+
|
38
40
|
## kitchen.yml Options
|
39
41
|
```yaml
|
40
42
|
provisioner :
|
@@ -44,7 +46,7 @@ provisioner :
|
|
44
46
|
##
|
45
47
|
## Optional argument
|
46
48
|
ansible_config : "/path/to/ansible/ansible.cfg" # path to ansible config file
|
47
|
-
verbose : "vvvv" #
|
49
|
+
verbose : "vvvv" # verbose level v, vv, vvv, vvvv
|
48
50
|
diff : true # print file diff
|
49
51
|
mygroup : "web" # ansible group, or list of groups
|
50
52
|
raw_arguments : "--timeout=200"
|
@@ -67,18 +69,20 @@ provisioner :
|
|
67
69
|
use_instance_name : false # use short (platform) instead of instance name by default
|
68
70
|
idempotency_test : false
|
69
71
|
```
|
70
|
-
##
|
71
|
-
If you want to check your code is idempotent you can use the idempotency_test. Essentially, this will run Ansible twice and check nothing changed in the
|
72
|
+
## Idempotency test
|
73
|
+
If you want to check your code is idempotent you can use the idempotency_test. Essentially, this will run Ansible twice and check nothing changed in the second run. If something changed it will list the tasks. Note: If your using Ansible callback in your config this might conflict.
|
74
|
+
|
72
75
|
```yaml
|
73
76
|
idempotency_test: true
|
74
77
|
fail_non_idempotent: true
|
75
78
|
```
|
76
79
|
|
77
|
-
If your running ansible V2 you need to white list the callback ```
|
80
|
+
If your running ansible V2 you need to white list the callback ```callback_whitelist = changes``` in **ansible.cfg**
|
78
81
|
You can also choose to not to fail if idempotency test fails.
|
79
82
|
|
80
83
|
## Ansible version
|
81
84
|
Since ansiblepush uses the host to run Ansible. you can simply specify the path of your ansible-playbook executable in your .kitchen.yml
|
85
|
+
|
82
86
|
```yaml
|
83
87
|
ansible_playbook_bin : /path/to/ansible-playbook
|
84
88
|
```
|
@@ -88,6 +92,7 @@ For further example you can check a matrix test [ansible-usermanage](https://git
|
|
88
92
|
|
89
93
|
## Disable chef installation
|
90
94
|
By default chef is installed and serverspec stuff. if you don't want to install
|
95
|
+
|
91
96
|
```yaml
|
92
97
|
chef_bootstrap_url: nil
|
93
98
|
```
|
@@ -99,7 +104,8 @@ Ansible push generates inventory dynamically you have multiple options to name y
|
|
99
104
|
|
100
105
|
## Windows support
|
101
106
|
Kitchen ansiblepush has experimental support.
|
102
|
-
to enable windows support you need to add the following to your
|
107
|
+
to enable windows support you need to add the following to your *.kitchen.yml*
|
108
|
+
|
103
109
|
```yaml
|
104
110
|
...
|
105
111
|
transport:
|
@@ -108,6 +114,7 @@ transport:
|
|
108
114
|
provisioner:
|
109
115
|
name : ansible_push
|
110
116
|
chef_bootstrap_url : nil
|
117
|
+
ansible_port : 5586
|
111
118
|
ansible_connection : "winrm"
|
112
119
|
...
|
113
120
|
```
|
@@ -118,6 +125,7 @@ You can use ansible push with different pattern. I will list some of the ways t
|
|
118
125
|
I define my Gemfile in the role. I then run ```bundle install``` and commit my *Gemfile.lock* I also ignore ```.kitchen```
|
119
126
|
|
120
127
|
A typical structure of an ansible role
|
128
|
+
|
121
129
|
```yaml
|
122
130
|
defaults
|
123
131
|
handlers
|
@@ -10,7 +10,7 @@ require 'kitchen-ansible/idempotancy'
|
|
10
10
|
module Kitchen
|
11
11
|
class Busser
|
12
12
|
def non_suite_dirs
|
13
|
-
%w
|
13
|
+
%w[{data}]
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -249,7 +249,7 @@ module Kitchen
|
|
249
249
|
end
|
250
250
|
debug("hostname='#{hostname}'")
|
251
251
|
# Generate hosts
|
252
|
-
hosts = generate_instance_inventory(machine_name, hostname, conf[:mygroup], instance_connection_option, conf
|
252
|
+
hosts = generate_instance_inventory(machine_name, hostname, conf[:mygroup], instance_connection_option, conf)
|
253
253
|
write_var_to_yaml("#{TEMP_INV_DIR}/ansiblepush_host_#{machine_name}.yml", hosts)
|
254
254
|
# Generate groups (if defined)
|
255
255
|
write_var_to_yaml(TEMP_GROUP_FILE, conf[:groups]) if conf[:groups]
|
@@ -8,12 +8,13 @@ def write_var_to_yaml(yaml_file, hash_var)
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
def generate_instance_inventory(name, host, mygroup, instance_connection_option,
|
11
|
+
def generate_instance_inventory(name, host, mygroup, instance_connection_option, conf)
|
12
12
|
unless instance_connection_option.nil?
|
13
13
|
port = instance_connection_option[:port]
|
14
14
|
keys = instance_connection_option[:keys]
|
15
15
|
user = instance_connection_option[:user]
|
16
|
-
pass = instance_connection_option[:pass]
|
16
|
+
pass = instance_connection_option[:pass] if instance_connection_option[:pass]
|
17
|
+
pass = instance_connection_option[:password] if instance_connection_option[:password]
|
17
18
|
end
|
18
19
|
|
19
20
|
temp_hash = {}
|
@@ -23,10 +24,12 @@ def generate_instance_inventory(name, host, mygroup, instance_connection_option,
|
|
23
24
|
temp_hash['ansible_ssh_user'] = user if user
|
24
25
|
temp_hash['ansible_ssh_pass'] = pass if pass
|
25
26
|
temp_hash['mygroup'] = mygroup if mygroup
|
27
|
+
temp_hash['ansible_ssh_port'] = conf[:ansible_port] if conf[:ansible_port]
|
26
28
|
# Windows issue ignore SSL
|
27
|
-
if ansible_connection == 'winrm'
|
29
|
+
if conf[:ansible_connection] == 'winrm'
|
28
30
|
temp_hash['ansible_winrm_server_cert_validation'] = 'ignore'
|
29
31
|
temp_hash['ansible_winrm_transport'] = 'ssl'
|
32
|
+
temp_hash['ansible_connection'] = 'winrm'
|
30
33
|
end
|
31
34
|
{ name => temp_hash }
|
32
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-ansiblepush
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adham Helal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-kitchen
|