kitchen-ansiblepush 0.9.1 → 0.11.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 +5 -5
- data/README.md +17 -1
- data/bin/kitchen-ansible-inventory +2 -1
- data/kitchen-ansiblepush.gemspec +1 -1
- data/lib/kitchen/provisioner/ansible_push.rb +17 -0
- data/lib/kitchen-ansible/util_inventory.rb +2 -0
- data/lib/kitchen-ansible/version.rb +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: b23b040db1827ecb2b42a524b6fa05f5ce870ef8e2ddb858bf7112ba51c305d8
|
|
4
|
+
data.tar.gz: f328cb4cf4a8a4a0b92aa587e1441a93906eb1da3f546413a4f63b38e733d2d7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 92e816f149f19692ac9679a0c8166af59065ac25092c5b6eec4f080cb6fe0b18e9e35a42aa2d93195236ab3d9d83223ac363c5ead45c43df9d4eba0a4061884a
|
|
7
|
+
data.tar.gz: e0ff570800f085e060da6999cd5386e57abbd2b54a8a2fd384b30b1e306ea7365998fc53367d9aced467768567503db857f474b9face96c191274b56ae8f2f2f
|
data/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# kitchen-ansiblepush
|
|
2
2
|
[](https://badge.fury.io/rb/kitchen-ansiblepush)
|
|
3
3
|
[](https://rubygems.org/gems/kitchen-ansiblepush)
|
|
4
|
-
|
|
4
|
+

|
|
5
5
|
|
|
6
6
|
A test-kitchen plugin that adds the support for ansible in push mode i.e. normal mode :)
|
|
7
7
|
|
|
@@ -68,6 +68,12 @@ provisioner :
|
|
|
68
68
|
generate_inv : true
|
|
69
69
|
use_instance_name : false # use short (platform) instead of instance name by default
|
|
70
70
|
idempotency_test : false
|
|
71
|
+
|
|
72
|
+
## When running on EC2 with Windows and using get-password pass the password as ansible_password variable
|
|
73
|
+
pass_transport_password: false
|
|
74
|
+
## (optional), if you want to set specific environment variables when running ansible
|
|
75
|
+
environment_vars:
|
|
76
|
+
PROXMOX_URL: https://example.com:8006
|
|
71
77
|
```
|
|
72
78
|
## Idempotency test
|
|
73
79
|
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.
|
|
@@ -125,6 +131,16 @@ provisioner:
|
|
|
125
131
|
...
|
|
126
132
|
```
|
|
127
133
|
|
|
134
|
+
### Windows AWS EC2 support
|
|
135
|
+
|
|
136
|
+
When running EC2 instance without password set via _get_password_ password can be passed from transport to Ansible command line as varaible:
|
|
137
|
+
|
|
138
|
+
```yaml
|
|
139
|
+
provisioner:
|
|
140
|
+
name: ansible_push
|
|
141
|
+
pass_transport_password: true
|
|
142
|
+
```
|
|
143
|
+
|
|
128
144
|
## Pattern of usage
|
|
129
145
|
|
|
130
146
|
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.
|
data/kitchen-ansiblepush.gemspec
CHANGED
|
@@ -55,6 +55,8 @@ module Kitchen
|
|
|
55
55
|
default_config :ssh_extra_args, nil
|
|
56
56
|
default_config :ssh_common_args, nil
|
|
57
57
|
default_config :module_path, nil
|
|
58
|
+
default_config :pass_transport_password, false
|
|
59
|
+
default_config :environment_vars, {}
|
|
58
60
|
|
|
59
61
|
# For tests disable if not needed
|
|
60
62
|
default_config :chef_bootstrap_url, 'https://omnitruck.chef.io/install.sh'
|
|
@@ -87,6 +89,12 @@ module Kitchen
|
|
|
87
89
|
|
|
88
90
|
raise UserError, "ansible extra_vars is in valid type: #{config[:extra_vars].class} value: #{config[:extra_vars]}" unless extra_vars_is_valid
|
|
89
91
|
end
|
|
92
|
+
|
|
93
|
+
unless config[:environment_vars].is_a?(Hash)
|
|
94
|
+
raise UserError,
|
|
95
|
+
"ansible environment_vars is not a `Hash` type. Given type: #{config[:environment_vars].class}"
|
|
96
|
+
end
|
|
97
|
+
|
|
90
98
|
info('Ansible push config validated')
|
|
91
99
|
@validated_config = config
|
|
92
100
|
end
|
|
@@ -119,6 +127,10 @@ module Kitchen
|
|
|
119
127
|
temp_options << "--user=#{conf[:remote_user]}" if remote_user
|
|
120
128
|
temp_options << "--become-method=#{conf[:become_method]}" if conf[:become_method]
|
|
121
129
|
temp_options << '--ask-sudo-pass' if conf[:ask_sudo_pass]
|
|
130
|
+
|
|
131
|
+
# if running on windows in ec2 and password is obtained via get-password
|
|
132
|
+
temp_options << "-e ansible_password='#{instance.transport.instance_variable_get(:@connection_options)[:password]}'" if conf[:pass_transport_password]
|
|
133
|
+
|
|
122
134
|
temp_options
|
|
123
135
|
end
|
|
124
136
|
|
|
@@ -171,6 +183,11 @@ module Kitchen
|
|
|
171
183
|
'ANSIBLE_HOST_KEY_CHECKING' => conf[:host_key_checking].to_s
|
|
172
184
|
}
|
|
173
185
|
@command_env['ANSIBLE_CONFIG'] = conf[:ansible_config] if conf[:ansible_config]
|
|
186
|
+
|
|
187
|
+
# NOTE: Manually merge to fix keys possibly being Symbol(s)
|
|
188
|
+
conf[:environment_vars].each do |key, value|
|
|
189
|
+
@command_env[key.to_s] = value
|
|
190
|
+
end
|
|
174
191
|
@command_env
|
|
175
192
|
end
|
|
176
193
|
|
|
@@ -30,6 +30,8 @@ def generate_instance_inventory(name, host, mygroup, instance_connection_option,
|
|
|
30
30
|
temp_hash['ansible_winrm_server_cert_validation'] = 'ignore'
|
|
31
31
|
temp_hash['ansible_winrm_transport'] = 'ssl'
|
|
32
32
|
temp_hash['ansible_connection'] = 'winrm'
|
|
33
|
+
temp_hash['ansible_host'] = temp_hash['ansible_ssh_host']
|
|
34
|
+
temp_hash['ansible_user'] = temp_hash['ansible_ssh_user']
|
|
33
35
|
end
|
|
34
36
|
{ name => temp_hash }
|
|
35
37
|
end
|
metadata
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kitchen-ansiblepush
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.11.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:
|
|
11
|
+
date: 2022-09-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: test-kitchen
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: '1.4'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - "
|
|
24
|
+
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '1.4'
|
|
27
27
|
description: |+
|
|
@@ -69,8 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
69
69
|
- !ruby/object:Gem::Version
|
|
70
70
|
version: '0'
|
|
71
71
|
requirements: []
|
|
72
|
-
|
|
73
|
-
rubygems_version: 2.5.2
|
|
72
|
+
rubygems_version: 3.0.3.1
|
|
74
73
|
signing_key:
|
|
75
74
|
specification_version: 4
|
|
76
75
|
summary: ansible provisioner for test-kitchen
|