kitchen-ansiblepush 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +19 -8
- data/callback/changes.py +4 -2
- data/lib/kitchen-ansible/print_inventory_cli.rb +0 -0
- data/lib/kitchen-ansible/version.rb +1 -1
- data/lib/kitchen/provisioner/ansible_push.rb +2 -0
- 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: 2792ec1be3d5497fa3ba68a8d2a077307e8793a1
|
|
4
|
+
data.tar.gz: 9e6ce1e36d47af5563b4316815cbaaa8d55bf479
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 511bb93a0bb4f7d647a8e2721f957419412316e04a5358e5d375d33c74722c4ae5d60fe17bebc8dfaeff6db7464f03b7e808f63f24135be66b719c9e7f049f66
|
|
7
|
+
data.tar.gz: b4cd34996a1ac0db558a734bea519faa109c66bbac4cb55b2c2616de0cb0eca8563492b21e5980768f3110f4a9ef428a3d2ac00e8cdc60f6cd5c3ee0be6dc723
|
data/README.md
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
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 instance(s). That also means your code will not be copied to 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
|
-
It is designed to just simply work with minimum configuration. Just run as you would normaly do.
|
|
11
|
+
It is designed to just simply work with minimum configuration. Just run as you would normaly do.
|
|
12
12
|
|
|
13
13
|
## How to install
|
|
14
14
|
|
|
@@ -80,7 +80,8 @@ If you want to check your code is idempotent you can use the idempotency_test. E
|
|
|
80
80
|
If your running ansible V2 you need to white list the callback ```callback_whitelist = changes``` in **ansible.cfg**
|
|
81
81
|
You can also choose to not to fail if idempotency test fails.
|
|
82
82
|
|
|
83
|
-
##
|
|
83
|
+
## Ansible version
|
|
84
|
+
|
|
84
85
|
Since ansiblepush uses the host to run Ansible. you can simply specify the path of your ansible-playbook executable in your .kitchen.yml
|
|
85
86
|
|
|
86
87
|
```yaml
|
|
@@ -91,18 +92,23 @@ If you want any easy way to manage ansible version [AVM](https://github.com/ahel
|
|
|
91
92
|
For further example you can check a matrix test [ansible-usermanage](https://github.com/AutomationWithAnsible/ansible-usermanage/blob/master/.kitchen.yml)
|
|
92
93
|
|
|
93
94
|
## Disable chef installation
|
|
95
|
+
|
|
94
96
|
By default chef is installed and serverspec stuff. if you don't want to install
|
|
95
97
|
|
|
96
98
|
```yaml
|
|
97
99
|
chef_bootstrap_url: nil
|
|
98
100
|
```
|
|
101
|
+
|
|
99
102
|
## Instance name
|
|
103
|
+
|
|
100
104
|
Ansible push generates inventory dynamically you have multiple options to name your instance
|
|
101
|
-
*use_instance_name*
|
|
102
|
-
*custom_instance_name*
|
|
103
105
|
|
|
106
|
+
* *use_instance_name* = false (default): <platform>
|
|
107
|
+
* *use_instance_name* = true: <instance_name>-<platform>
|
|
108
|
+
* *custom_instance_name*: <custom_instance_name>
|
|
104
109
|
|
|
105
110
|
## Windows support
|
|
111
|
+
|
|
106
112
|
Kitchen ansiblepush has experimental support.
|
|
107
113
|
to enable windows support you need to add the following to your *.kitchen.yml*
|
|
108
114
|
|
|
@@ -118,8 +124,11 @@ provisioner:
|
|
|
118
124
|
ansible_connection : "winrm"
|
|
119
125
|
...
|
|
120
126
|
```
|
|
127
|
+
|
|
121
128
|
## Pattern of usage
|
|
129
|
+
|
|
122
130
|
You can use ansible push with different pattern. I will list some of the ways that I use it, But by no means they are the only patterns.
|
|
131
|
+
|
|
123
132
|
### Roles
|
|
124
133
|
|
|
125
134
|
I define my Gemfile in the role. I then run ```bundle install``` and commit my *Gemfile.lock* I also ignore ```.kitchen```
|
|
@@ -149,12 +158,14 @@ test
|
|
|
149
158
|
```
|
|
150
159
|
|
|
151
160
|
## Real example usages
|
|
161
|
+
|
|
162
|
+
- https://github.com/ahelal/ansible-concourse
|
|
152
163
|
- https://github.com/hellofresh/ansible-deployment
|
|
153
164
|
- https://github.com/AutomationWithAnsible/ansible-usermanage
|
|
154
|
-
- https://github.com/ahelal/ansible-concourse
|
|
155
165
|
- https://github.com/danrue/ansible-variables
|
|
156
166
|
- https://github.com/knakayama/kitchen-ansiblepush-demo
|
|
157
167
|
|
|
158
168
|
## TODO
|
|
159
|
-
|
|
160
|
-
|
|
169
|
+
|
|
170
|
+
* Enable environment var ANSIBLE_CALLBACK_WHITELIST="changes" before call
|
|
171
|
+
* Tests (PRs for tests is highlight appreciated)
|
data/callback/changes.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import json
|
|
2
1
|
import os
|
|
3
2
|
import errno
|
|
3
|
+
import json as js
|
|
4
|
+
if not hasattr(js, 'dumps'):
|
|
5
|
+
js = js.json
|
|
4
6
|
|
|
5
7
|
try:
|
|
6
8
|
from ansible.plugins.callback import CallbackBase
|
|
@@ -44,7 +46,7 @@ class CallbackModule(CallbackBase):
|
|
|
44
46
|
|
|
45
47
|
try:
|
|
46
48
|
with open(self.change_file, 'at') as the_file:
|
|
47
|
-
the_file.write(
|
|
49
|
+
the_file.write(js.dumps(changed_data) + "\n")
|
|
48
50
|
except Exception, e:
|
|
49
51
|
print "Ansible callback idempotency: Write to file failed '%s' error:'%s'" % (self.change_file, e)
|
|
50
52
|
exit(1)
|
|
File without changes
|
|
@@ -95,6 +95,8 @@ module Kitchen
|
|
|
95
95
|
return @machine_name if defined? @machine_name
|
|
96
96
|
@machine_name = if config[:use_instance_name]
|
|
97
97
|
instance.name.gsub(/[<>]/, '')
|
|
98
|
+
elsif config[:custom_instance_name]
|
|
99
|
+
config[:custom_instance_name]
|
|
98
100
|
else
|
|
99
101
|
instance.name.gsub(/[<>]/, '').split('-').drop(1).join('-')
|
|
100
102
|
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.8.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-09-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: test-kitchen
|