foreman_ansible 5.1.1 → 6.0.2

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: e0aa6750e2a4a664a8751b884adee730fbb792221e02596a334e3d6aa3955f84
4
- data.tar.gz: f7e9287de112b986314c36603ffccc2e4a776bdfd151e2e2d09ce2232c04e5b4
3
+ metadata.gz: 3f071261ab8d77b0963a3ee7a82e198139cf095391a9140efb6a7d954778a5fa
4
+ data.tar.gz: 0355abc8c57df2c8af562546353d76b663d4a4634fb7b16f937a59eb13c3c4e8
5
5
  SHA512:
6
- metadata.gz: 9559f94d0fc7ab3be558c999ea36305817809c15069104363c934d3e2bbd46e9ca99d8065dd61210de4545e980f8beab5c71bdabcb36fc3e43edf83181f4e654
7
- data.tar.gz: 7b426a84ece0047b636498828ff2af087200022a88c295c1e52ee4fd799849fa3a2eaeeee7ac9e79b2d45714b0b0b20f33fcdb18b1f759f22f85d8424b6e3ca4
6
+ metadata.gz: dfe1e9afb9fb2be9ec55bb2df53c132daa25f8ede8918734bcc6992fc4a75b687bebb32b382abdb5ddb8bd842c890f13e583c932f250e700a2237c1ccf7eda6b
7
+ data.tar.gz: 2c065cb05f42b4bcf52003a64e8466542ebc6eec5e6fcda5332f8f0f6a0a6f4f9f5c031cda9ae82c306402f6820c15c9a7194d9a2a776aa054276d4dfee2b044
@@ -28,6 +28,12 @@ class AnsibleRole < ApplicationRecord
28
28
  scoped_search :relation => :hostgroups,
29
29
  :on => :name, :rename => :hostgroup, :only_explicit => true
30
30
 
31
+ apipie :class, "A class representing #{model_name.human} object" do
32
+ name 'Ansible role'
33
+ refs 'AnsibleRole'
34
+ sections only: %w[all additional]
35
+ property :name, String, desc: 'Returns name of the ansible role'
36
+ end
31
37
  # Methods to be allowed in any template with safemode enabled
32
38
  class Jail < Safemode::Jail
33
39
  allow :name
@@ -67,6 +67,11 @@ end
67
67
 
68
68
  module Host
69
69
  class Managed
70
+ apipie :class do
71
+ property :all_ansible_roles, array_of: 'AnsibleRole', desc: 'Returns all ansible roles assigned to the host, both its own and inherited'
72
+ property :ansible_roles, array_of: 'AnsibleRole', desc: 'Returns ansible roles assigned to the host'
73
+ property :inherited_ansible_roles, array_of: 'AnsibleRole', desc: 'Returns inherited ansible roles assigned to the host'
74
+ end
70
75
  # Methods to be allowed in any template with safemode enabled
71
76
  class Jail < Safemode::Jail
72
77
  allow :all_ansible_roles, :ansible_roles, :inherited_ansible_roles
@@ -35,8 +35,8 @@ if defined? ForemanRemoteExecution
35
35
  {
36
36
  'per-host' => {
37
37
  host.name => {
38
- 'ansible_ssh_pass' => rex_ssh_password(host),
39
- 'ansible_sudo_pass' => rex_sudo_password(host)
38
+ 'ansible_password' => rex_ssh_password(host),
39
+ 'ansible_become_password' => rex_effective_user_password(host)
40
40
  }
41
41
  }
42
42
  }
@@ -46,8 +46,8 @@ if defined? ForemanRemoteExecution
46
46
  host_setting(host, 'remote_execution_ssh_password')
47
47
  end
48
48
 
49
- def rex_sudo_password(host)
50
- host_setting(host, 'remote_execution_sudo_password')
49
+ def rex_effective_user_password(host)
50
+ host_setting(host, 'remote_execution_effective_user_password')
51
51
  end
52
52
 
53
53
  def host_setting(host, setting)
@@ -62,12 +62,8 @@ if defined? ForemanRemoteExecution
62
62
  'ansible-runner'
63
63
  end
64
64
 
65
- def required_proxy_selector_for(template)
66
- if template.remote_execution_features.where(:label => 'ansible_run_capsule_upgrade').any?
67
- ::DefaultProxyProxySelector.new
68
- else
69
- super
70
- end
65
+ def proxy_action_class
66
+ 'ForemanAnsibleCore::TaskLauncher::Playbook::PlaybookRunnerAction'
71
67
  end
72
68
 
73
69
  private
@@ -9,7 +9,7 @@ module ForemanAnsible
9
9
  included do
10
10
  def host
11
11
  hostname = name.downcase
12
- if AnsibleReportScanner.ansible_report?(raw['logs']) &&
12
+ if AnsibleReportScanner.ansible_report?(raw) &&
13
13
  IPAddress.valid?(hostname) &&
14
14
  Nic::Interface.find_by(:ip => hostname)
15
15
  @host = Nic::Interface.find_by(:ip => hostname).host
@@ -5,14 +5,17 @@ module ForemanAnsible
5
5
  # sets the origin of the report to 'Ansible'
6
6
  class AnsibleReportScanner
7
7
  class << self
8
- def scan(report, logs)
9
- if (is_ansible = ansible_report?(logs))
10
- report.origin = 'Ansible'
11
- end
12
- is_ansible
8
+ def add_reporter_data(report, raw); end
9
+
10
+ def identify_origin(raw)
11
+ 'Ansible' if ansible_report?(raw)
12
+ end
13
+
14
+ def ansible_report?(raw)
15
+ raw['reporter'] == 'ansible' || ansible_legacy_report?(raw['logs'])
13
16
  end
14
17
 
15
- def ansible_report?(logs)
18
+ def ansible_legacy_report?(logs)
16
19
  return false if logs.blank?
17
20
  logs.any? do |log|
18
21
  log['log'].fetch('messages', {}).
@@ -4,7 +4,18 @@ module ForemanAnsible
4
4
  # Macro to fetch RH Insights plan playbook
5
5
  module RendererMethods
6
6
  extend ActiveSupport::Concern
7
+ extend ApipieDSL::Module
7
8
 
9
+ apipie :class, 'Macros related to Ansible playbooks' do
10
+ name 'Ansible'
11
+ sections only: %w[all jobs]
12
+ end
13
+
14
+ apipie :method, 'Returns Insights maintenance plan for host' do
15
+ required :plan_id, String, desc: 'The playbook for the rule coming from insights'
16
+ optional :organization_id, Integer, desc: 'The Foreman organization associated with the Insights account', default: 'Current organization ID'
17
+ returns String, desc: 'Insights maintenance plan for host'
18
+ end
8
19
  def insights_remediation(plan_id, organization_id = Organization.current.id)
9
20
  return "$INSIGHTS_REMEDIATION[#{plan_id}, #{organization_id}]" if preview?
10
21
 
@@ -78,7 +78,7 @@ module ForemanAnsible
78
78
  def create_new_variables(variables)
79
79
  iterate_over_variables(variables) do |role, memo, attrs|
80
80
  variable = AnsibleVariable.new(
81
- JSON.parse(attrs)['ansible_variable']
81
+ JSON.parse(attrs)
82
82
  )
83
83
  variable.ansible_role = ::AnsibleRole.find_by(:name => role)
84
84
  variable.save
@@ -88,7 +88,7 @@ module ForemanAnsible
88
88
 
89
89
  def update_variables(variables)
90
90
  iterate_over_variables(variables) do |_role, memo, attrs|
91
- attributes = JSON.parse(attrs)['ansible_variable']
91
+ attributes = JSON.parse(attrs)
92
92
  var = AnsibleVariable.find attributes['id']
93
93
  var.update(attributes)
94
94
  memo << var
@@ -98,7 +98,7 @@ module ForemanAnsible
98
98
  def delete_old_variables(variables)
99
99
  iterate_over_variables(variables) do |_role, memo, attrs|
100
100
  variable = AnsibleVariable.find(
101
- JSON.parse(attrs)['ansible_variable']['id']
101
+ JSON.parse(attrs)['id']
102
102
  )
103
103
  memo << variable.key
104
104
  variable.destroy
@@ -4,7 +4,7 @@
4
4
  <%= icon_text("play", "", :kind => "fa") %>
5
5
  </div>
6
6
  <h1><%= _('Ansible Roles') %></h1>
7
- <p><%= _('No ansible roles were found in Foreman. If you want to assign roles to your hosts,
7
+ <p><%= _('No Ansible Roles were found in Foreman. If you want to assign roles to your hosts,
8
8
  you have to import them first.').html_safe %>
9
9
  </p>
10
10
  <p><%= link_to(_('Learn more about this in the documentation.'), documentation_url('#4.1ImportingRoles', :root_url => ansible_doc_url), target: '_blank') %></p>
@@ -15,7 +15,7 @@ template_inputs:
15
15
  value_type: plain
16
16
  hidden_value: false
17
17
  model: JobTemplate
18
- job_category: Ansible Playbook
18
+ job_category: Maintenance Operations
19
19
  description_format: "%{template_name}"
20
20
  provider_type: Ansible
21
21
  kind: job_template
@@ -41,8 +41,11 @@ feature: ansible_run_capsule_upgrade
41
41
  when: "'rubygem-foreman_maintain' not in ansible_facts.packages"
42
42
 
43
43
  - block:
44
+ <%- whitelist_option = if input('whitelist_options').present?
45
+ "--whitelist=#{input('whitelist_options')}"
46
+ end -%>
44
47
  - name: Upgrade Capsule server using satellite-maintain
45
- shell: satellite-maintain upgrade run --assumeyes --target-version=<%= input('target_version') %> --whitelist="<%= input('whitelist_options') %>"
48
+ shell: satellite-maintain upgrade run --assumeyes --target-version=<%= input('target_version') %> <%= whitelist_option %>
46
49
  register: result
47
50
 
48
51
  - name: Re-Gather the rpm package facts after the upgrade
@@ -22,10 +22,11 @@ template_inputs:
22
22
  hidden_value: false
23
23
  description: You can specify a HTTP proxy address that should be used for Cloud Connector connection to the cloud.redhat.com. Note that it must be HTTP proxy, not HTTPS. The tunelling of SSL (secured web socket connection) in SSL (HTTPS proxy) is currently unsupported.
24
24
  model: JobTemplate
25
- job_category: Ansible Playbook
25
+ job_category: Maintenance Operations
26
26
  description_format: "%{template_name}"
27
27
  provider_type: Ansible
28
28
  kind: job_template
29
+ feature: ansible_configure_cloud_connector
29
30
  %>
30
31
 
31
32
  ---
@@ -0,0 +1,16 @@
1
+ <%#
2
+ name: Service Action - Enable Web Console
3
+ job_category: Ansible Services
4
+ snippet: false
5
+ provider_type: Ansible
6
+ kind: job_template
7
+ model: JobTemplate
8
+ feature: ansible_enable_web_console
9
+ %>
10
+ ---
11
+ - hosts: all
12
+ tasks:
13
+ - name: ensure cockpit is installed
14
+ package:
15
+ name: "cockpit-system"
16
+ state: present
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Foreman::Plugin.register :foreman_ansible do
4
- requires_foreman '>= 2.0'
4
+ requires_foreman '>= 2.2'
5
5
 
6
6
  security_block :foreman_ansible do
7
7
  permission :play_roles_on_host,
@@ -109,6 +109,10 @@ Foreman::Plugin.register :foreman_ansible do
109
109
  apipie_documented_controllers [
110
110
  "#{ForemanAnsible::Engine.root}/app/controllers/api/v2/*.rb"
111
111
  ]
112
+ ApipieDSL.configuration.dsl_classes_matchers += [
113
+ "#{ForemanAnsible::Engine.root}/app/models/*.rb",
114
+ "#{ForemanAnsible::Engine.root}/app/services/foreman_ansible/*.rb"
115
+ ]
112
116
 
113
117
  register_info_provider ForemanAnsible::AnsibleInfo
114
118
 
@@ -45,7 +45,14 @@ module ForemanAnsible
45
45
  RemoteExecutionFeature.register(
46
46
  :ansible_run_capsule_upgrade,
47
47
  N_('Upgrade Capsules on given hosts'),
48
- :description => N_('Upgrade Capsules on given Capsule server hosts')
48
+ :description => N_('Upgrade Capsules on given Capsule server hosts'),
49
+ :proxy_selector_override => ::RemoteExecutionProxySelector::INTERNAL_PROXY
50
+ )
51
+ RemoteExecutionFeature.register(
52
+ :ansible_configure_cloud_connector,
53
+ N_('Configure Cloud Connector on given hosts'),
54
+ :description => N_('Configure Cloud Connector on given hosts'),
55
+ :proxy_selector_override => ::RemoteExecutionProxySelector::INTERNAL_PROXY
49
56
  )
50
57
  end
51
58
  end
@@ -4,5 +4,5 @@
4
4
  # This way other parts of Foreman can just call ForemanAnsible::VERSION
5
5
  # and detect what version the plugin is running.
6
6
  module ForemanAnsible
7
- VERSION = '5.1.1'
7
+ VERSION = '6.0.2'
8
8
  end
@@ -1,4 +1,5 @@
1
1
  {
2
+ "reporter": "ansible",
2
3
  "reported_at":"2018-01-15 17:31:36 521275",
3
4
  "metrics": {
4
5
  "time":
@@ -17,7 +18,7 @@
17
18
  "source": "common : Install Common packages"
18
19
  },
19
20
  "messages": {
20
- "message": "{\"msg\": \"All items completed\", \"changed\": false, \"results\": [{\"_ansible_parsed\": true, \"changed\": false, \"_ansible_no_log\": false, \"cache_updated\": false, \"_ansible_item_result\": true, \"failed\": false, \"item\": \"git\", \"invocation\": {\"module_args\": {\"dpkg_options\": \"force-confdef,force-confold\", \"upgrade\": null, \"force\": false, \"force_apt_get\": false, \"package\": [\"git\"], \"autoclean\": false, \"name\": \"git\", \"purge\": false, \"allow_unauthenticated\": false, \"state\": \"present\", \"autoremove\": false, \"update_cache\": null, \"default_release\": null, \"only_upgrade\": false, \"cache_valid_time\": 0, \"deb\": null, \"install_recommends\": null}}, \"_ansible_ignore_errors\": null, \"cache_update_time\": 1515797094}, {\"_ansible_parsed\": true, \"changed\": false, \"_ansible_no_log\": false, \"cache_updated\": false, \"_ansible_item_result\": true, \"failed\": false, \"item\": \"htop\", \"invocation\": {\"module_args\": {\"dpkg_options\": \"force-confdef,force-confold\", \"upgrade\": null, \"force\": false, \"force_apt_get\": false, \"package\": [\"htop\"], \"autoclean\": false, \"name\": \"htop\", \"purge\": false, \"allow_unauthenticated\": false, \"state\": \"present\", \"autoremove\": false, \"update_cache\": null, \"default_release\": null, \"only_upgrade\": false, \"cache_valid_time\": 0, \"deb\": null, \"install_recommends\": null}}, \"_ansible_ignore_errors\": null, \"cache_update_time\": 1515797094}, {\"_ansible_parsed\": true, \"changed\": false, \"_ansible_no_log\": false, \"cache_updated\": false, \"_ansible_item_result\": true, \"failed\": false, \"item\": \"zsh\", \"invocation\": {\"module_args\": {\"dpkg_options\": \"force-confdef,force-confold\", \"upgrade\": null, \"force\": false, \"force_apt_get\": false, \"package\": [\"zsh\"], \"autoclean\": false, \"name\": \"zsh\", \"purge\": false, \"allow_unauthenticated\": false, \"state\": \"present\", \"autoremove\": false, \"update_cache\": null, \"default_release\": null, \"only_upgrade\": false, \"cache_valid_time\": 0, \"deb\": null, \"install_recommends\": null}}, \"_ansible_ignore_errors\": null, \"cache_update_time\": 1515797094}]}"},"level":"info"}},{"log":{"sources":{"source":"common : Copy default motd"},"messages":{"message":"{\"_ansible_parsed\": true, \"group\": \"root\", \"uid\": 0, \"checksum\": \"0a381ff6a86081af6dc957a77c7e2017a3244c4c\", \"changed\": false, \"owner\": \"root\", \"state\": \"file\", \"gid\": 0, \"mode\": \"0644\", \"diff\": {\"after\": {\"path\": \"/etc/motd\"}, \"before\": {\"path\": \"/etc/motd\"}}, \"invocation\": {\"module_args\": {\"directory_mode\": null, \"force\": false, \"remote_src\": null, \"path\": \"/etc/motd\", \"owner\": \"root\", \"follow\": false, \"group\": \"root\", \"unsafe_writes\": null, \"state\": \"file\", \"content\": null, \"serole\": null, \"diff_peek\": null, \"setype\": null, \"dest\": \"/etc/motd\", \"selevel\": null, \"original_basename\": \"motd.txt\", \"regexp\": null, \"validate\": null, \"src\": \"motd.txt\", \"seuser\": null, \"recurse\": false, \"delimiter\": null, \"mode\": null, \"attributes\": null, \"backup\": null}}, \"path\": \"/etc/motd\", \"size\": 1090, \"_ansible_no_log\": false}"
21
+ "message": "{\"msg\": \"All items completed\", \"changed\": false, \"results\": [{\"changed\": false, \"_ansible_no_log\": false, \"cache_updated\": false, \"_ansible_item_result\": true, \"failed\": false, \"item\": \"git\", \"invocation\": {\"module_args\": {\"dpkg_options\": \"force-confdef,force-confold\", \"upgrade\": null, \"force\": false, \"force_apt_get\": false, \"package\": [\"git\"], \"autoclean\": false, \"name\": \"git\", \"purge\": false, \"allow_unauthenticated\": false, \"state\": \"present\", \"autoremove\": false, \"update_cache\": null, \"default_release\": null, \"only_upgrade\": false, \"cache_valid_time\": 0, \"deb\": null, \"install_recommends\": null}}, \"_ansible_ignore_errors\": null, \"cache_update_time\": 1515797094}, {\"_ansible_parsed\": true, \"changed\": false, \"_ansible_no_log\": false, \"cache_updated\": false, \"_ansible_item_result\": true, \"failed\": false, \"item\": \"htop\", \"invocation\": {\"module_args\": {\"dpkg_options\": \"force-confdef,force-confold\", \"upgrade\": null, \"force\": false, \"force_apt_get\": false, \"package\": [\"htop\"], \"autoclean\": false, \"name\": \"htop\", \"purge\": false, \"allow_unauthenticated\": false, \"state\": \"present\", \"autoremove\": false, \"update_cache\": null, \"default_release\": null, \"only_upgrade\": false, \"cache_valid_time\": 0, \"deb\": null, \"install_recommends\": null}}, \"_ansible_ignore_errors\": null, \"cache_update_time\": 1515797094}, {\"_ansible_parsed\": true, \"changed\": false, \"_ansible_no_log\": false, \"cache_updated\": false, \"_ansible_item_result\": true, \"failed\": false, \"item\": \"zsh\", \"invocation\": {\"module_args\": {\"dpkg_options\": \"force-confdef,force-confold\", \"upgrade\": null, \"force\": false, \"force_apt_get\": false, \"package\": [\"zsh\"], \"autoclean\": false, \"name\": \"zsh\", \"purge\": false, \"allow_unauthenticated\": false, \"state\": \"present\", \"autoremove\": false, \"update_cache\": null, \"default_release\": null, \"only_upgrade\": false, \"cache_valid_time\": 0, \"deb\": null, \"install_recommends\": null}}, \"_ansible_ignore_errors\": null, \"cache_update_time\": 1515797094}]}"},"level":"info"}},{"log":{"sources":{"source":"common : Copy default motd"},"messages":{"message":"{\"_ansible_parsed\": true, \"group\": \"root\", \"uid\": 0, \"checksum\": \"0a381ff6a86081af6dc957a77c7e2017a3244c4c\", \"changed\": false, \"owner\": \"root\", \"state\": \"file\", \"gid\": 0, \"mode\": \"0644\", \"diff\": {\"after\": {\"path\": \"/etc/motd\"}, \"before\": {\"path\": \"/etc/motd\"}}, \"invocation\": {\"module_args\": {\"directory_mode\": null, \"force\": false, \"remote_src\": null, \"path\": \"/etc/motd\", \"owner\": \"root\", \"follow\": false, \"group\": \"root\", \"unsafe_writes\": null, \"state\": \"file\", \"content\": null, \"serole\": null, \"diff_peek\": null, \"setype\": null, \"dest\": \"/etc/motd\", \"selevel\": null, \"original_basename\": \"motd.txt\", \"regexp\": null, \"validate\": null, \"src\": \"motd.txt\", \"seuser\": null, \"recurse\": false, \"delimiter\": null, \"mode\": null, \"attributes\": null, \"backup\": null}}, \"path\": \"/etc/motd\", \"size\": 1090, \"_ansible_no_log\": false}"
21
22
  },
22
23
  "level": "info"
23
24
  }
@@ -35,13 +35,13 @@ class AnsibleProviderTest < ActiveSupport::TestCase
35
35
  it 'generates secrets properly' do
36
36
  params = {
37
37
  'remote_execution_ssh_password' => 'password',
38
- 'remote_execution_sudo_password' => 'letmein'
38
+ 'remote_execution_effective_user_password' => 'letmein'
39
39
  }
40
40
  host.expects(:params).twice.returns(params)
41
41
  secrets = ForemanAnsible::AnsibleProvider.secrets(host)
42
42
  host_secrets = secrets['per-host'][host.name]
43
- assert_equal host_secrets['ansible_ssh_pass'], 'password'
44
- assert_equal host_secrets['ansible_sudo_pass'], 'letmein'
43
+ assert_equal host_secrets['ansible_password'], 'password'
44
+ assert_equal host_secrets['ansible_become_password'], 'letmein'
45
45
  end
46
46
  end
47
47
 
@@ -24,7 +24,7 @@ module ForemanAnsibleCore
24
24
  '_meta' => { 'hostvars' => { 'foreman.example.com' => {} } } }
25
25
  end
26
26
  let(:input) do
27
- host_secrets = { 'ansible_ssh_pass' => 'letmein', 'ansible_sudo_pass' => 'iamroot' }
27
+ host_secrets = { 'ansible_password' => 'letmein', 'ansible_become_password' => 'iamroot' }
28
28
  secrets = { 'per-host' => { 'foreman.example.com' => host_secrets } }
29
29
  host_input = { 'input' => { 'action_input' => { 'secrets' => secrets } } }
30
30
  { 'foreman.example.com' => host_input }
@@ -32,18 +32,18 @@ module ForemanAnsibleCore
32
32
  let(:runner) { ForemanAnsibleCore::Runner::AnsibleRunner.allocate }
33
33
 
34
34
  test 'uses secrets from inventory' do
35
- test_inventory = inventory.merge('ssh_password' => 'sshpass', 'sudo_password' => 'sudopass')
35
+ test_inventory = inventory.merge('ssh_password' => 'sshpass', 'effective_user_password' => 'mypass')
36
36
  rebuilt = runner.send(:rebuild_secrets, test_inventory, input)
37
37
  host_vars = rebuilt.dig('_meta', 'hostvars', 'foreman.example.com')
38
- assert_equal 'sshpass', host_vars['ansible_ssh_pass']
39
- assert_equal 'sudopass', host_vars['ansible_sudo_pass']
38
+ assert_equal 'sshpass', host_vars['ansible_password']
39
+ assert_equal 'mypass', host_vars['ansible_become_password']
40
40
  end
41
41
 
42
42
  test 'host secrets are used when not overriden by inventory secrest' do
43
43
  rebuilt = runner.send(:rebuild_secrets, inventory, input)
44
44
  host_vars = rebuilt.dig('_meta', 'hostvars', 'foreman.example.com')
45
- assert_equal 'letmein', host_vars['ansible_ssh_pass']
46
- assert_equal 'iamroot', host_vars['ansible_sudo_pass']
45
+ assert_equal 'letmein', host_vars['ansible_password']
46
+ assert_equal 'iamroot', host_vars['ansible_become_password']
47
47
  end
48
48
  end
49
49
  end
@@ -87,24 +87,24 @@ class PlaybookRunnerTest < ActiveSupport::TestCase
87
87
  '_meta' => { 'hostvars' => { 'foreman.example.com' => {} } } }
88
88
  end
89
89
  let(:secrets) do
90
- host_secrets = { 'ansible_ssh_pass' => 'letmein', 'ansible_sudo_pass' => 'iamroot' }
90
+ host_secrets = { 'ansible_password' => 'letmein', 'ansible_become_password' => 'iamroot' }
91
91
  { 'per-host' => { 'foreman.example.com' => host_secrets } }
92
92
  end
93
93
  let(:runner) { ForemanAnsibleCore::Runner::Playbook.allocate }
94
94
 
95
95
  test 'uses secrets from inventory' do
96
- test_inventory = inventory.merge('ssh_password' => 'sshpass', 'sudo_password' => 'sudopass')
96
+ test_inventory = inventory.merge('ssh_password' => 'sshpass', 'effective_user_password' => 'mypass')
97
97
  rebuilt = runner.send(:rebuild_secrets, test_inventory, secrets)
98
98
  host_vars = rebuilt.dig('_meta', 'hostvars', 'foreman.example.com')
99
- assert_equal 'sshpass', host_vars['ansible_ssh_pass']
100
- assert_equal 'sudopass', host_vars['ansible_sudo_pass']
99
+ assert_equal 'sshpass', host_vars['ansible_password']
100
+ assert_equal 'mypass', host_vars['ansible_become_password']
101
101
  end
102
102
 
103
103
  test 'host secrets are used when not overriden by inventory secrest' do
104
104
  rebuilt = runner.send(:rebuild_secrets, inventory, secrets)
105
105
  host_vars = rebuilt.dig('_meta', 'hostvars', 'foreman.example.com')
106
- assert_equal 'letmein', host_vars['ansible_ssh_pass']
107
- assert_equal 'iamroot', host_vars['ansible_sudo_pass']
106
+ assert_equal 'letmein', host_vars['ansible_password']
107
+ assert_equal 'iamroot', host_vars['ansible_become_password']
108
108
  end
109
109
  end
110
110
  end
@@ -10,7 +10,7 @@ module ForemanAnsible
10
10
  @host = FactoryBot.build(:host)
11
11
  @template_invocation = OpenStruct.new(
12
12
  :job_invocation => OpenStruct.new(:password => 'foobar',
13
- :sudo_password => 'foobar'),
13
+ :effective_user_password => 'foobar'),
14
14
  :effective_user => 'foobar'
15
15
  )
16
16
  end
@@ -69,8 +69,8 @@ module ForemanAnsible
69
69
  connection_params['ansible_winrm_server_cert_validation']
70
70
  assert_equal Setting['remote_execution_effective_user_method'],
71
71
  connection_params['ansible_become_method']
72
- refute connection_params.key?('ansible_ssh_pass')
73
- refute connection_params.key?('ansible_sudo_pass')
72
+ refute connection_params.key?('ansible_password')
73
+ refute connection_params.key?('ansible_become_password')
74
74
  end
75
75
 
76
76
  test 'ssh private key is passed when available' do
@@ -10,7 +10,7 @@ const theme = {
10
10
 
11
11
  const ReportJsonViewer = ({ data }) => (
12
12
  <div className="report-json-viewer">
13
- <JSONTree data={this.props.data} hideRoot theme={theme} />
13
+ <JSONTree data={data} hideRoot theme={theme} />
14
14
  </div>
15
15
  );
16
16
 
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_ansible
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.1
4
+ version: 6.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Lobato Garcia
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-05 00:00:00.000000000 Z
11
+ date: 2021-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rubocop
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: 0.80.0
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: 0.80.0
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: foreman_ansible_core
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +44,14 @@ dependencies:
58
44
  requirements:
59
45
  - - ">="
60
46
  - !ruby/object:Gem::Version
61
- version: 3.3.0
47
+ version: 4.2.0
62
48
  type: :runtime
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
52
  - - ">="
67
53
  - !ruby/object:Gem::Version
68
- version: 3.3.0
54
+ version: 4.2.0
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: ipaddress
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -196,6 +182,7 @@ files:
196
182
  - app/views/foreman_ansible/job_templates/run_command_-_ansible_default.erb
197
183
  - app/views/foreman_ansible/job_templates/run_playbook-ansible_default.erb
198
184
  - app/views/foreman_ansible/job_templates/service_action_-_ansible_default.erb
185
+ - app/views/foreman_ansible/job_templates/service_action_-_enable_web_console.erb
199
186
  - app/views/ui_ansible_roles/index.json.rabl
200
187
  - app/views/ui_ansible_roles/main.json.rabl
201
188
  - app/views/ui_ansible_roles/show.json.rabl
@@ -346,7 +333,7 @@ homepage: https://github.com/theforeman/foreman_ansible
346
333
  licenses:
347
334
  - GPL-3.0
348
335
  metadata: {}
349
- post_install_message:
336
+ post_install_message:
350
337
  rdoc_options: []
351
338
  require_paths:
352
339
  - lib
@@ -361,8 +348,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
361
348
  - !ruby/object:Gem::Version
362
349
  version: '0'
363
350
  requirements: []
364
- rubygems_version: 3.0.3
365
- signing_key:
351
+ rubygems_version: 3.1.2
352
+ signing_key:
366
353
  specification_version: 4
367
354
  summary: Ansible integration with Foreman (theforeman.org)
368
355
  test_files:
@@ -372,39 +359,39 @@ test_files:
372
359
  - test/fixtures/insights_playbook.yaml
373
360
  - test/fixtures/report.json
374
361
  - test/fixtures/sample_facts.json
362
+ - test/functional/ansible_roles_controller_test.rb
363
+ - test/functional/ansible_variables_controller_test.rb
364
+ - test/functional/api/v2/ansible_inventories_controller_test.rb
375
365
  - test/functional/api/v2/ansible_roles_controller_test.rb
366
+ - test/functional/api/v2/ansible_variables_controller_test.rb
376
367
  - test/functional/api/v2/hostgroups_controller_test.rb
377
368
  - test/functional/api/v2/hosts_controller_test.rb
378
- - test/functional/api/v2/ansible_inventories_controller_test.rb
379
- - test/functional/api/v2/ansible_variables_controller_test.rb
380
- - test/functional/ansible_roles_controller_test.rb
381
- - test/functional/ansible_variables_controller_test.rb
382
- - test/functional/ui_ansible_roles_controller_test.rb
383
369
  - test/functional/hosts_controller_test.rb
370
+ - test/functional/ui_ansible_roles_controller_test.rb
371
+ - test/test_plugin_helper.rb
384
372
  - test/unit/actions/run_ansible_job_test.rb
385
373
  - test/unit/actions/run_proxy_ansible_command_test.rb
374
+ - test/unit/ansible_role_test.rb
375
+ - test/unit/ansible_variable_test.rb
386
376
  - test/unit/concerns/config_reports_extensions_test.rb
387
377
  - test/unit/concerns/host_managed_extensions_test.rb
388
378
  - test/unit/concerns/hostgroup_extensions_test.rb
389
379
  - test/unit/helpers/ansible_reports_helper_test.rb
380
+ - test/unit/host_ansible_role_test.rb
381
+ - test/unit/hostgroup_ansible_role_test.rb
390
382
  - test/unit/lib/foreman_ansible_core/command_creator_test.rb
391
383
  - test/unit/lib/foreman_ansible_core/ansible_runner_test.rb
392
384
  - test/unit/lib/foreman_ansible_core/playbook_runner_test.rb
393
385
  - test/unit/lib/proxy_api/ansible_test.rb
386
+ - test/unit/services/ansible_report_importer_test.rb
387
+ - test/unit/services/ansible_variables_importer_test.rb
394
388
  - test/unit/services/api_roles_importer_test.rb
389
+ - test/unit/services/fact_importer_test.rb
390
+ - test/unit/services/fact_parser_test.rb
395
391
  - test/unit/services/fact_sparser_test.rb
396
392
  - test/unit/services/insights_plan_runner_test.rb
397
393
  - test/unit/services/roles_importer_test.rb
398
394
  - test/unit/services/structured_fact_importer_test.rb
399
395
  - test/unit/services/ui_roles_importer_test.rb
400
- - test/unit/services/ansible_report_importer_test.rb
401
- - test/unit/services/fact_importer_test.rb
402
- - test/unit/services/fact_parser_test.rb
403
396
  - test/unit/services/inventory_creator_test.rb
404
- - test/unit/services/ansible_variables_importer_test.rb
405
- - test/unit/ansible_role_test.rb
406
- - test/unit/host_ansible_role_test.rb
407
- - test/unit/hostgroup_ansible_role_test.rb
408
397
  - test/unit/ansible_provider_test.rb
409
- - test/unit/ansible_variable_test.rb
410
- - test/test_plugin_helper.rb