smart_proxy_ansible 3.5.4 → 3.5.6

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
  SHA256:
3
- metadata.gz: aeca31386ddf249d6cbce37e14bac2be1217132e9d7700595d1a98bfce4f9edb
4
- data.tar.gz: d46c8e35fe05c3d2808226eda74a14b26cf77a5bfcc66f494d6e680f21893173
3
+ metadata.gz: cdb206292fd57f3df0b026850f14e36a171ab612441a07eabda038564ed9882e
4
+ data.tar.gz: f81ec06c89616f468f8e0b2e91337604ac53083813afb78ac0428b81c2c3fab8
5
5
  SHA512:
6
- metadata.gz: a64fc645a04b2348cb94e9975a059ff72d053de4c0f95d256f10c2219eb68f691fb0abdcb1d08d2893467cd607ab49cd474a1f1c633718c8ef6c46c256c2a6ca
7
- data.tar.gz: e093cc229af6dffb46ead2c4d7118d53e87d3a78ab67d1d5256130b95ae95b9beccb89186d95365e789abcbc99df67d661b1cc4a6d90dd4e90ffa3ec571b24bc
6
+ metadata.gz: c43173334f7e61412176729557b0d259c9f5a4c1be8e1e13d41c0a5fecc77ad2c4a3768b3d43dcd41db53ce46fbf5b5cf81328ebdaa3045fb083d4bff44ea835
7
+ data.tar.gz: de9b416be34c2a2f6abf0b9ef1747911356fdb770cfa3ea90ee37dc409b78f9b168477c3656327ecbfa412ddfe335e1043b9510c4260b58d5e50370df5eb8f6a
@@ -167,15 +167,10 @@ module Proxy::Ansible
167
167
  end
168
168
 
169
169
  def write_inventory
170
- path = File.join(@root, 'inventory', 'hosts')
171
- data_path = File.join(@root, 'data')
172
- inventory_script = <<~INVENTORY_SCRIPT
173
- #!/bin/sh
174
- cat #{::Shellwords.escape data_path}
175
- INVENTORY_SCRIPT
176
- File.write(path, inventory_script)
177
- File.write(data_path, JSON.dump(@inventory))
178
- File.chmod(0o0755, path)
170
+ File.open(File.join(@root, 'inventory', 'hosts.json'), 'w') do |file|
171
+ file.chmod(0o0640)
172
+ file.write(JSON.dump(@inventory))
173
+ end
179
174
  end
180
175
 
181
176
  def write_playbook
@@ -252,7 +247,6 @@ module Proxy::Ansible
252
247
  # containing all the hosts.
253
248
  def rebuild_inventory(input)
254
249
  action_inputs = input.values.map { |hash| hash[:input][:action_input] }
255
- hostnames = action_inputs.map { |hash| hash[:name] }
256
250
  inventories = action_inputs.map { |hash| hash[:ansible_inventory] }
257
251
  host_vars = inventories.map { |i| i['_meta']['hostvars'] }.reduce({}) do |acc, hosts|
258
252
  hosts.reduce(acc) do |inner_acc, (hostname, vars)|
@@ -261,8 +255,7 @@ module Proxy::Ansible
261
255
  end
262
256
  end
263
257
 
264
- { '_meta' => { 'hostvars' => host_vars },
265
- 'all' => { 'hosts' => hostnames,
258
+ { 'all' => { 'hosts' => host_vars,
266
259
  'vars' => inventories.first['all']['vars'] } }
267
260
  end
268
261
 
@@ -283,10 +276,10 @@ module Proxy::Ansible
283
276
  per_host = secrets['per-host'][host]
284
277
 
285
278
  new_secrets = {
286
- 'ansible_password' => inventory['ssh_password'] || per_host['ansible_password'],
287
- 'ansible_become_password' => inventory['effective_user_password'] || per_host['ansible_become_password']
279
+ 'ansible_password' => secrets['ssh_password'] || per_host['ansible_password'],
280
+ 'ansible_become_password' => secrets['effective_user_password'] || per_host['ansible_become_password']
288
281
  }
289
- inventory['_meta']['hostvars'][host].update(new_secrets)
282
+ inventory['all']['hosts'][host].update(new_secrets)
290
283
  end
291
284
 
292
285
  inventory
@@ -2,6 +2,6 @@ module Proxy
2
2
  # Version, this allows the proxy and other plugins know
3
3
  # what version of the Ansible plugin is running
4
4
  module Ansible
5
- VERSION = '3.5.4'
5
+ VERSION = '3.5.6'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_proxy_ansible
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.4
4
+ version: 3.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-03-21 00:00:00.000000000 Z
12
+ date: 2024-07-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  - !ruby/object:Gem::Version
187
187
  version: '0'
188
188
  requirements: []
189
- rubygems_version: 3.1.4
189
+ rubygems_version: 3.2.3
190
190
  signing_key:
191
191
  specification_version: 4
192
192
  summary: Smart-Proxy Ansible plugin