smart_proxy_ansible 3.4.1 → 3.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e690f2c224c01d97752317ca99ae54ac84a01f45fc2d613c727477d0acbcdcf
4
- data.tar.gz: 0ec2124072f46f08a9820dee2311dce4a72c44980701ed3ab12697788be1e2ca
3
+ metadata.gz: 8bf2021531a3d54fed65d1a3f9065d665e24d3d9868c648baac4a37b22bf2ebd
4
+ data.tar.gz: 0a8b69f873e29e44163cd8a69532741fa9852129a11494ea79f411f0d588c91a
5
5
  SHA512:
6
- metadata.gz: 1b9e32a10bec5a241ea8e6d5aa9727f67e31b7cac1f47b6181ab14177942a48d722d23d54dc324a1fdfb19e0f57d442f80126a93e06331551700210628d8b7c8
7
- data.tar.gz: 83f106b39297d92d521a2472db2c6c8c5a8d60b6391ea88b16a455e2d01070df6acb03ce2138474e8790a6d2495b897a1e118d4954af5115cba6f914a1e0de13
6
+ metadata.gz: b3d18efc8724bf3045f103b033ecdf3f30287a0ed7bfdef3e6f81a754a87491999e0a7e570b2ce7c33a318acc2ce71dbbb690bec574335adc102f2935efc1852
7
+ data.tar.gz: 0f94311f78476c38c79fb212b4e7c316294da2bef6073ef53ed31c6dc34eba724b0463938881dfda0fcfb02b0afa566c4aa6f65dd0927c7620ebf7a92b1cffaa
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+
3
+ [ -f "$SMART_PROXY_ANSIBLE_ENVIRONMENT_FILE" ] && source "$SMART_PROXY_ANSIBLE_ENVIRONMENT_FILE"
4
+ exec "$@"
@@ -5,7 +5,8 @@ module Proxy
5
5
  rackup_path File.expand_path('http_config.ru', __dir__)
6
6
  settings_file 'ansible.yml'
7
7
  plugin :ansible, Proxy::Ansible::VERSION
8
- default_settings :ansible_dir => Dir.home
8
+ default_settings :ansible_dir => Dir.home,
9
+ :ansible_environment_file => '/etc/foreman-proxy/ansible.env'
9
10
  # :working_dir => nil
10
11
 
11
12
  load_classes ::Proxy::Ansible::ConfigurationLoader
@@ -25,9 +25,13 @@ module Proxy
25
25
  line =~ /^\s*#{config_key}/
26
26
  end
27
27
  rescue Errno::ENOENT, Errno::EACCES => e
28
- RolesReader.logger.debug(e.backtrace)
29
- message = "Could not read Ansible config file #{DEFAULT_CONFIG_FILE} - #{e.message}"
30
- raise ReadConfigFileException.new(message), message
28
+ message = "Could not read Ansible config file #{DEFAULT_CONFIG_FILE}, using defaults - #{e.message}"
29
+ if e.is_a?(Errno::ENOENT)
30
+ RolesReader.logger.info(message)
31
+ else
32
+ RolesReader.logger.warn(message)
33
+ end
34
+ []
31
35
  end
32
36
 
33
37
  def playbook_or_role_full_name(path)
@@ -10,6 +10,9 @@ module Proxy::Ansible
10
10
  include ::Proxy::Dynflow::Runner::ProcessManagerCommand
11
11
  attr_reader :execution_timeout_interval
12
12
 
13
+ # To make this overridable in development
14
+ ENVIRONMENT_WRAPPER = ENV['SMART_PROXY_ANSIBLE_ENVIRONMENT_WRAPPER'] || '/usr/libexec/foreman-proxy/ansible-runner-environment'
15
+
13
16
  def initialize(input, suspended_action:, id: nil)
14
17
  super input, :suspended_action => suspended_action, :id => id
15
18
  @inventory = rebuild_secrets(rebuild_inventory(input), input)
@@ -187,10 +190,12 @@ module Proxy::Ansible
187
190
  def start_ansible_runner
188
191
  env = {}
189
192
  env['FOREMAN_CALLBACK_DISABLE'] = '1' if @rex_command
190
- command = [env, 'ansible-runner', 'run', @root, '-p', 'playbook.yml']
193
+ env['SMART_PROXY_ANSIBLE_ENVIRONMENT_FILE'] = Proxy::Ansible::Plugin.settings[:ansible_environment_file]
194
+ command = ['ansible-runner', 'run', @root, '-p', 'playbook.yml']
191
195
  command << '--cmdline' << cmdline unless cmdline.nil?
192
196
  command << verbosity if verbose?
193
- initialize_command(*command)
197
+
198
+ initialize_command(env, ENVIRONMENT_WRAPPER, *command)
194
199
  logger.debug("[foreman_ansible] - Running command '#{command.join(' ')}'")
195
200
  end
196
201
 
@@ -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.4.1'
5
+ VERSION = '3.5.1'
6
6
  end
7
7
  end
@@ -1,3 +1,4 @@
1
1
  ---
2
2
  :enabled: true
3
3
  :working_dir: '~/.foreman-ansible'
4
+ # :ansible_environment_file: /etc/foreman-proxy/ansible.env
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.4.1
4
+ version: 3.5.1
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: 2022-09-05 00:00:00.000000000 Z
12
+ date: 2023-02-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -149,6 +149,7 @@ extra_rdoc_files:
149
149
  files:
150
150
  - LICENSE
151
151
  - README.md
152
+ - bin/ansible-runner-environment.sh
152
153
  - bin/json_inventory.sh
153
154
  - bundler.d/ansible.rb
154
155
  - lib/smart_proxy_ansible.rb
@@ -185,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
186
  - !ruby/object:Gem::Version
186
187
  version: '0'
187
188
  requirements: []
188
- rubygems_version: 3.1.6
189
+ rubygems_version: 3.1.4
189
190
  signing_key:
190
191
  specification_version: 4
191
192
  summary: Smart-Proxy Ansible plugin