kitchen-ansiblepush 0.9.1 → 0.10.1

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
2
  SHA1:
3
- metadata.gz: efea995a7c668283411ba103bcc13593262781a6
4
- data.tar.gz: b33917a9c23ac9a5c7974cd3c1d0c004ad0da548
3
+ metadata.gz: 4cddf05fc2cac0808c450d5a3e279268870e869e
4
+ data.tar.gz: b40f2372c447f9fda2ad2c12f87a07e615dcfa68
5
5
  SHA512:
6
- metadata.gz: 7f80a480cbc21f781db47e0928f695dc3f7bee97035fd60ae3997dffd036d066cf0e09ab806887b23810cb937c6ea8eaba09ee34475c3f8ee4820cc3cd33780f
7
- data.tar.gz: 5f6b62dbff1ff4999f8653a1702f5806e68f6ec4a65ab4b2448c5229dc9ebf6a29043fcba96e3e0b4ff2c70a023cf2b863f2e2508ec268909271a720193f302f
6
+ metadata.gz: 93354ede800e70c0cae24e42bb2c63fe9f6b052acc70643a16925bd04f955f87548ab37e0b7b275f719791fb5c7ad4679d267bb25c37e4bc7919fb828d792321
7
+ data.tar.gz: ccf14a905847beabfa73e2785e5b45b227de02acfecede71211588ec096a2baa96221b0adeee9fbab13cc21a361432132f9e45668b2c5ba51e5f0967626ca685
data/README.md CHANGED
@@ -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.
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Kitchen
2
2
  module AnsiblePush
3
- VERSION = '0.9.1'.freeze
3
+ VERSION = '0.10.1'.freeze
4
4
  end
5
5
  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
 
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.10.1
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: 2019-04-21 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: |+
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  version: '0'
71
71
  requirements: []
72
72
  rubyforge_project: "[none]"
73
- rubygems_version: 2.5.2
73
+ rubygems_version: 2.5.2.3
74
74
  signing_key:
75
75
  specification_version: 4
76
76
  summary: ansible provisioner for test-kitchen