foreman_ansible 7.1.2 → 9.0.0
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 +4 -4
- data/app/controllers/foreman_ansible/api/v2/hostgroups_controller_extensions.rb +5 -1
- data/app/controllers/foreman_ansible/api/v2/hosts_controller_extensions.rb +3 -1
- data/app/helpers/foreman_ansible/ansible_hostgroups_helper.rb +15 -0
- data/app/helpers/foreman_ansible/ansible_reports_helper.rb +0 -4
- data/app/helpers/foreman_ansible/hosts_helper.rb +19 -0
- data/app/services/foreman_ansible/variables_importer.rb +9 -9
- data/app/views/api/v2/hostgroups/ansible_roles.json.rabl +9 -1
- data/app/views/api/v2/hosts/ansible_roles.json.rabl +9 -1
- data/config/routes.rb +3 -3
- data/db/migrate/20200421201839_update_ansible_inv_template_name.rb +1 -5
- data/lib/foreman_ansible/engine.rb +0 -1
- data/lib/foreman_ansible/register.rb +10 -2
- data/lib/foreman_ansible/remote_execution.rb +0 -6
- data/lib/foreman_ansible/version.rb +1 -1
- data/locale/action_names.rb +4 -3
- data/locale/ca/foreman_ansible.po +360 -45
- data/locale/cs_CZ/foreman_ansible.po +372 -57
- data/locale/de/foreman_ansible.po +355 -40
- data/locale/en/foreman_ansible.po +355 -40
- data/locale/en_GB/foreman_ansible.po +357 -42
- data/locale/es/foreman_ansible.po +355 -40
- data/locale/foreman_ansible.pot +767 -263
- data/locale/fr/foreman_ansible.po +355 -40
- data/locale/gl/foreman_ansible.po +358 -43
- data/locale/it/foreman_ansible.po +355 -40
- data/locale/ja/foreman_ansible.po +355 -40
- data/locale/ko/foreman_ansible.po +355 -40
- data/locale/nl_NL/foreman_ansible.po +359 -44
- data/locale/pl/foreman_ansible.po +363 -48
- data/locale/pt_BR/foreman_ansible.po +355 -40
- data/locale/ru/foreman_ansible.po +355 -40
- data/locale/sv_SE/foreman_ansible.po +363 -48
- data/locale/zh_CN/foreman_ansible.po +355 -40
- data/locale/zh_TW/foreman_ansible.po +355 -40
- data/webpack/components/AnsibleHostDetail/components/RolesTab/AllRolesModal/AllRolesTable.js +11 -1
- data/webpack/components/AnsibleHostDetail/components/RolesTab/RolesTable.js +10 -1
- data/webpack/components/AnsibleHostDetail/components/RolesTab/__test__/RolesTab.fixtures.js +30 -0
- data/webpack/components/AnsibleRolesSwitcher/components/AnsibleRole.js +3 -12
- data/webpack/components/AnsibleRolesSwitcher/components/OrderedRolesTooltip.js +11 -12
- data/webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AnsibleRole.test.js.snap +6 -20
- data/webpack/graphql/queries/allAnsibleRoles.gql +3 -0
- data/webpack/graphql/queries/hostAnsibleRoles.gql +3 -0
- metadata +4 -6
- data/app/helpers/foreman_ansible/hosts_helper_extensions.rb +0 -30
- data/app/overrides/hostgroup_play_roles.rb +0 -9
- data/app/views/foreman_ansible/ansible_roles/_hostgroup_ansible_roles_button.erb +0 -19
- data/app/views/foreman_ansible/job_templates/configure_cloud_connector_-_ansible_default.erb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df3c4d8c1514c442f1da8c0c6ef356482f5edb63ca14df0e39ef83818076f22b
|
4
|
+
data.tar.gz: 253b5ef0614bb34d78ad96b7312537b496b4850ea34d6ba7a960f9df34da5e02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6f8201c41db492b56888c675cb460f88e5dae92aeb808487747783ba43031961a27f66eb2df975216385b8e003d2df645f4208f0a1f0d4bec44b0c02f878984
|
7
|
+
data.tar.gz: da19e080f0fa135ae2cb4757fae4a10a946989ecc953cf41eb774877b075bcfc68455707d4abc3a4265fdcb1421714572947bb14eefc709a8d825d6c23623987
|
@@ -46,7 +46,11 @@ module ForemanAnsible
|
|
46
46
|
find_resource
|
47
47
|
return unless @hostgroup
|
48
48
|
|
49
|
-
@
|
49
|
+
@inherited_ansible_roles = @hostgroup.inherited_ansible_roles
|
50
|
+
@directly_assigned_roles = @hostgroup.ansible_roles
|
51
|
+
@ansible_roles = (
|
52
|
+
@directly_assigned_roles + @inherited_ansible_roles + @hostgroup.host_ansible_roles
|
53
|
+
).uniq
|
50
54
|
end
|
51
55
|
|
52
56
|
api :POST, '/hostgroups/:id/assign_ansible_roles',
|
@@ -49,7 +49,9 @@ module ForemanAnsible
|
|
49
49
|
def ansible_roles
|
50
50
|
return unless @host
|
51
51
|
|
52
|
-
@
|
52
|
+
@inherited_ansible_roles = @host.inherited_ansible_roles
|
53
|
+
@directly_assigned_roles = @host.ansible_roles
|
54
|
+
@ansible_roles = (@directly_assigned_roles + @inherited_ansible_roles).uniq
|
53
55
|
end
|
54
56
|
|
55
57
|
api :POST, '/hosts/:id/assign_ansible_roles',
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ForemanAnsible
|
4
|
+
module AnsibleHostgroupsHelper
|
5
|
+
def ansible_hostgroups_actions(hostgroup)
|
6
|
+
play_roles = if hostgroup.all_ansible_roles.empty?
|
7
|
+
{ action: (link_to _('Run all Ansible roles'), 'javascript:void(0);', disabled: true, title: 'No Roles assigned'), priority: 31 }
|
8
|
+
else
|
9
|
+
{ action: display_link_if_authorized(_('Run all Ansible roles'), hash_for_play_roles_hostgroup_path(id: hostgroup), 'data-no-turbolink': true, title: _('Run all Ansible roles on hosts belonging to this host group')), priority: 31 }
|
10
|
+
end
|
11
|
+
|
12
|
+
[play_roles] if User.current.can?(:create_job_invocations)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ForemanAnsible
|
4
|
+
module HostsHelper
|
5
|
+
def ansible_hosts_multiple_actions
|
6
|
+
return [] unless User.current.can?(:create_job_invocations) &&
|
7
|
+
User.current.can?(:play_roles_on_host)
|
8
|
+
|
9
|
+
[{ action: [_('Run all Ansible roles'),
|
10
|
+
multiple_play_roles_hosts_path,
|
11
|
+
false], priority: 1000 }]
|
12
|
+
end
|
13
|
+
|
14
|
+
def ansible_roles_present?(host)
|
15
|
+
host.ansible_roles.present? ||
|
16
|
+
host.inherited_ansible_roles.present?
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -31,14 +31,12 @@ module ForemanAnsible
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def import_variables(role_variables, new_roles)
|
34
|
-
detect_changes(
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end.select(&:present?).flatten.compact
|
41
|
-
)
|
34
|
+
detect_changes(role_variables.map do |role_name, variables|
|
35
|
+
next if variables.blank?
|
36
|
+
role = import_new_role(role_name, new_roles)
|
37
|
+
next if role.blank?
|
38
|
+
initialize_variables(variables, role)
|
39
|
+
end.select(&:present?).flatten.compact)
|
42
40
|
end
|
43
41
|
|
44
42
|
def import_variables_roles(roles)
|
@@ -96,7 +94,9 @@ module ForemanAnsible
|
|
96
94
|
persisted, changes[:new] = imported.partition { |var| var.id.present? }
|
97
95
|
changed, _old = persisted.partition(&:changed?)
|
98
96
|
_overriden, changes[:update] = changed.partition(&:override?)
|
99
|
-
changes[:obsolete] = AnsibleVariable.where.not(:
|
97
|
+
changes[:obsolete] = AnsibleVariable.where.not(id: persisted.pluck(:id)).
|
98
|
+
where.not(imported: false)
|
99
|
+
|
100
100
|
changes
|
101
101
|
end
|
102
102
|
|
@@ -2,4 +2,12 @@
|
|
2
2
|
|
3
3
|
collection @ansible_roles
|
4
4
|
|
5
|
-
|
5
|
+
extends 'api/v2/ansible_roles/show'
|
6
|
+
|
7
|
+
node :inherited do |role|
|
8
|
+
@inherited_ansible_roles.include?(role)
|
9
|
+
end
|
10
|
+
|
11
|
+
node :directly_assigned do |role|
|
12
|
+
@directly_assigned_roles.include?(role)
|
13
|
+
end
|
@@ -2,4 +2,12 @@
|
|
2
2
|
|
3
3
|
collection @ansible_roles
|
4
4
|
|
5
|
-
|
5
|
+
extends 'api/v2/ansible_roles/show'
|
6
|
+
|
7
|
+
node :inherited do |role|
|
8
|
+
@inherited_ansible_roles.include?(role)
|
9
|
+
end
|
10
|
+
|
11
|
+
node :directly_assigned do |role|
|
12
|
+
@directly_assigned_roles.include?(role)
|
13
|
+
end
|
data/config/routes.rb
CHANGED
@@ -1,9 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
Rails.application.routes.draw do
|
4
|
-
match '/ansible/hostgroups' => 'react#index', :via => [:get]
|
5
|
-
match '/ansible/hostgroups/*page' => 'react#index', :via => [:get]
|
6
|
-
|
7
4
|
namespace :api, defaults: { format: 'json' } do
|
8
5
|
scope '(:apiv)',
|
9
6
|
:module => :v2,
|
@@ -113,4 +110,7 @@ Rails.application.routes.draw do
|
|
113
110
|
end
|
114
111
|
end
|
115
112
|
end
|
113
|
+
|
114
|
+
match '/ansible/hostgroups' => 'react#index', :via => [:get]
|
115
|
+
match '/ansible/hostgroups/*page' => 'react#index', :via => [:get]
|
116
116
|
end
|
@@ -1,9 +1,5 @@
|
|
1
1
|
class UpdateAnsibleInvTemplateName < ActiveRecord::Migration[5.2]
|
2
2
|
def up
|
3
|
-
Setting
|
4
|
-
end
|
5
|
-
|
6
|
-
def down
|
7
|
-
Setting.where(:name => 'ansible_inventory_template').update_all(:default => 'Ansible Inventory')
|
3
|
+
# Setting defaults are updated automatically now
|
8
4
|
end
|
9
5
|
end
|
@@ -67,7 +67,6 @@ module ForemanAnsible
|
|
67
67
|
config.to_prepare do
|
68
68
|
::Host::Managed.prepend ForemanAnsible::HostManagedExtensions
|
69
69
|
::Hostgroup.include ForemanAnsible::HostgroupExtensions
|
70
|
-
::HostsHelper.include ForemanAnsible::HostsHelperExtensions
|
71
70
|
::HostsController.include ForemanAnsible::Concerns::HostsControllerExtensions
|
72
71
|
::Api::V2::HostsController.include ForemanAnsible::Api::V2::HostsControllerExtensions
|
73
72
|
::Api::V2::HostsController.include ForemanAnsible::Api::V2::HostsParamGroupExtensions
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
Foreman::Plugin.register :foreman_ansible do
|
4
|
-
requires_foreman '>= 3.
|
4
|
+
requires_foreman '>= 3.4'
|
5
5
|
|
6
6
|
settings do
|
7
7
|
category :ansible, N_('Ansible') do
|
@@ -187,7 +187,7 @@ Foreman::Plugin.register :foreman_ansible do
|
|
187
187
|
|
188
188
|
register_global_js_file 'global'
|
189
189
|
|
190
|
-
extend_graphql_type :type => ::Types::Host do
|
190
|
+
extend_graphql_type :type => '::Types::Host' do
|
191
191
|
field :all_ansible_roles, ::Types::InheritedAnsibleRole.connection_type, :null => true, :method => :present_all_ansible_roles
|
192
192
|
field :own_ansible_roles, ::Types::AnsibleRole.connection_type, :null => true
|
193
193
|
field :available_ansible_roles, ::Types::AnsibleRole.connection_type, :null => true
|
@@ -236,4 +236,12 @@ Foreman::Plugin.register :foreman_ansible do
|
|
236
236
|
register_report_scanner ForemanAnsible::AnsibleReportScanner
|
237
237
|
register_report_origin 'Ansible', 'ConfigReport'
|
238
238
|
end
|
239
|
+
|
240
|
+
describe_host do
|
241
|
+
multiple_actions_provider :ansible_hosts_multiple_actions
|
242
|
+
end
|
243
|
+
|
244
|
+
describe_hostgroup do
|
245
|
+
hostgroup_actions_provider :ansible_hostgroups_actions
|
246
|
+
end
|
239
247
|
end
|
@@ -48,12 +48,6 @@ module ForemanAnsible
|
|
48
48
|
:description => N_('Upgrade Capsules on given Capsule server hosts'),
|
49
49
|
:proxy_selector_override => ::RemoteExecutionProxySelector::INTERNAL_PROXY
|
50
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
|
56
|
-
)
|
57
51
|
end
|
58
52
|
end
|
59
53
|
end
|
data/locale/action_names.rb
CHANGED