kitchen-ansiblepush 0.9.1 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: efea995a7c668283411ba103bcc13593262781a6
4
- data.tar.gz: b33917a9c23ac9a5c7974cd3c1d0c004ad0da548
2
+ SHA256:
3
+ metadata.gz: b23b040db1827ecb2b42a524b6fa05f5ce870ef8e2ddb858bf7112ba51c305d8
4
+ data.tar.gz: f328cb4cf4a8a4a0b92aa587e1441a93906eb1da3f546413a4f63b38e733d2d7
5
5
  SHA512:
6
- metadata.gz: 7f80a480cbc21f781db47e0928f695dc3f7bee97035fd60ae3997dffd036d066cf0e09ab806887b23810cb937c6ea8eaba09ee34475c3f8ee4820cc3cd33780f
7
- data.tar.gz: 5f6b62dbff1ff4999f8653a1702f5806e68f6ec4a65ab4b2448c5229dc9ebf6a29043fcba96e3e0b4ff2c70a023cf2b863f2e2508ec268909271a720193f302f
6
+ metadata.gz: 92e816f149f19692ac9679a0c8166af59065ac25092c5b6eec4f080cb6fe0b18e9e35a42aa2d93195236ab3d9d83223ac363c5ead45c43df9d4eba0a4061884a
7
+ data.tar.gz: e0ff570800f085e060da6999cd5386e57abbd2b54a8a2fd384b30b1e306ea7365998fc53367d9aced467768567503db857f474b9face96c191274b56ae8f2f2f
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # kitchen-ansiblepush
2
2
  [![Gem Version](https://badge.fury.io/rb/kitchen-ansiblepush.svg)](https://badge.fury.io/rb/kitchen-ansiblepush)
3
3
  [![Gem Downloads](http://ruby-gem-downloads-badge.herokuapp.com/kitchen-ansiblepush?type=total&color=brightgreen)](https://rubygems.org/gems/kitchen-ansiblepush)
4
- [![Build Status](https://travis-ci.org/ahelal/kitchen-ansiblepush.svg?branch=master)](https://travis-ci.org/ahelal/kitchen-ansiblepush)
4
+ ![Ruby](https://github.com/ahelal/kitchen-ansiblepush/workflows/Ruby/badge.svg?branch=master)
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.
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
- require 'kitchen-ansible/print_inventory_cli.rb'
4
+ require 'kitchen-ansible/print_inventory_cli'
4
5
 
5
6
  print_inventory = PrintInventory.new
6
7
  print_inventory.run
@@ -26,5 +26,5 @@ Supports running ansible in push mode
26
26
 
27
27
  EOF
28
28
 
29
- gem.add_runtime_dependency 'test-kitchen', '~> 1.4'
29
+ gem.add_runtime_dependency 'test-kitchen', '>= 1.4'
30
30
  end
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Kitchen
2
2
  module AnsiblePush
3
- VERSION = '0.9.1'.freeze
3
+ VERSION = '0.11.0'.freeze
4
4
  end
5
5
  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.9.1
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: 2018-04-30 00:00:00.000000000 Z
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
- rubyforge_project: "[none]"
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