foreman_ansible 7.1.2 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/webpack/components/AnsibleHostDetail/components/RolesTab/AllRolesModal/AllRolesTable.js
CHANGED
@@ -15,7 +15,7 @@ import Pagination from 'foremanReact/components/Pagination';
|
|
15
15
|
import withLoading from '../../../../withLoading';
|
16
16
|
|
17
17
|
const AllRolesTable = ({ allAnsibleRoles, totalCount }) => {
|
18
|
-
const columns = [__('Name'), __('Source')];
|
18
|
+
const columns = [__('Name'), __('Variables'), __('Source')];
|
19
19
|
|
20
20
|
return (
|
21
21
|
<React.Fragment>
|
@@ -37,6 +37,16 @@ const AllRolesTable = ({ allAnsibleRoles, totalCount }) => {
|
|
37
37
|
<Tr key={`${role.id}-all`} id={role.id}>
|
38
38
|
<Td />
|
39
39
|
<Td>{role.name}</Td>
|
40
|
+
<Td>
|
41
|
+
<a
|
42
|
+
href={`/ansible/ansible_variables?search=ansible_role=${role.name}`}
|
43
|
+
target="_blank"
|
44
|
+
rel="noreferrer"
|
45
|
+
>
|
46
|
+
{role.ansibleVariables.totalCount}
|
47
|
+
</a>
|
48
|
+
</Td>
|
49
|
+
|
40
50
|
<Td>
|
41
51
|
{role.inherited
|
42
52
|
? __('Inherited from Hostgroup')
|
@@ -27,7 +27,7 @@ const RolesTable = ({
|
|
27
27
|
hostGlobalId,
|
28
28
|
canEditHost,
|
29
29
|
}) => {
|
30
|
-
const columns = [__('Name')];
|
30
|
+
const columns = [__('Name'), __('Variables')];
|
31
31
|
|
32
32
|
const editBtn = canEditHost ? (
|
33
33
|
<FlexItem>
|
@@ -72,6 +72,15 @@ const RolesTable = ({
|
|
72
72
|
<Td>
|
73
73
|
<a href={role.path}>{role.name}</a>
|
74
74
|
</Td>
|
75
|
+
<Td>
|
76
|
+
<a
|
77
|
+
href={`/ansible/ansible_variables?search=ansible_role=${role.name}`}
|
78
|
+
target="_blank"
|
79
|
+
rel="noreferrer"
|
80
|
+
>
|
81
|
+
{role.ansibleVariables.totalCount}
|
82
|
+
</a>
|
83
|
+
</Td>
|
75
84
|
</Tr>
|
76
85
|
))}
|
77
86
|
</Tbody>
|
@@ -35,6 +35,9 @@ const role1 = {
|
|
35
35
|
id: 'MDE6QW5zaWJsZVJvbGUtMw==',
|
36
36
|
name: 'aardvaark.cube',
|
37
37
|
path: '/ansible/ansible_roles/search="name = aardvaark.cube"',
|
38
|
+
ansibleVariables: {
|
39
|
+
totalCount: 1,
|
40
|
+
},
|
38
41
|
};
|
39
42
|
|
40
43
|
const role2 = {
|
@@ -42,6 +45,9 @@ const role2 = {
|
|
42
45
|
id: 'MDE6QW5zaWJsZVJvbGUtNQ==',
|
43
46
|
name: 'aardvaark.sphere',
|
44
47
|
path: '/ansible/ansible_roles/search="name = aardvaark.sphere"',
|
48
|
+
ansibleVariables: {
|
49
|
+
totalCount: 2,
|
50
|
+
},
|
45
51
|
};
|
46
52
|
|
47
53
|
const role3 = {
|
@@ -49,6 +55,9 @@ const role3 = {
|
|
49
55
|
id: 'MDE6QW5zaWJsZVJvbGUtMzA=',
|
50
56
|
name: 'another.role',
|
51
57
|
path: '/ansible/ansible_roles/search="name = another.role"',
|
58
|
+
ansibleVariables: {
|
59
|
+
totalCount: 3,
|
60
|
+
},
|
52
61
|
};
|
53
62
|
|
54
63
|
const role4 = {
|
@@ -56,6 +65,9 @@ const role4 = {
|
|
56
65
|
id: 'MDE6QW5zaWJsZVJvbGUtMzk=',
|
57
66
|
name: 'geerlingguy.ceylon',
|
58
67
|
path: '/ansible/ansible_roles/search="name = geerlingguy.ceylon"',
|
68
|
+
ansibleVariables: {
|
69
|
+
totalCount: 4,
|
70
|
+
},
|
59
71
|
};
|
60
72
|
|
61
73
|
const ansibleRolesMock = {
|
@@ -77,30 +89,45 @@ const availableRoles = {
|
|
77
89
|
name: 'theforeman.foreman_scap_client',
|
78
90
|
path:
|
79
91
|
'/ansible/ansible_roles/search="name = theforeman.foreman_scap_client"',
|
92
|
+
ansibleVariables: {
|
93
|
+
totalCount: 23,
|
94
|
+
},
|
80
95
|
},
|
81
96
|
{
|
82
97
|
__typename: 'AnsibleRole',
|
83
98
|
id: 'MDE6QW5zaWJsZVJvbGUtMg==',
|
84
99
|
name: 'adriagalin.motd',
|
85
100
|
path: '/ansible/ansible_roles/search="name = adriagalin.motd"',
|
101
|
+
ansibleVariables: {
|
102
|
+
totalCount: 23,
|
103
|
+
},
|
86
104
|
},
|
87
105
|
{
|
88
106
|
__typename: 'AnsibleRole',
|
89
107
|
id: 'MDE6QW5zaWJsZVJvbGUtMjI=',
|
90
108
|
name: 'geerlingguy.php',
|
91
109
|
path: '/ansible/ansible_roles/search="name = geerlingguy.php"',
|
110
|
+
ansibleVariables: {
|
111
|
+
totalCount: 23,
|
112
|
+
},
|
92
113
|
},
|
93
114
|
{
|
94
115
|
__typename: 'AnsibleRole',
|
95
116
|
id: 'MDE6QW5zaWJsZVJvbGUtNTc=',
|
96
117
|
name: 'robertdebock.epel',
|
97
118
|
path: '/ansible/ansible_roles/search="name = robertdebock.epel"',
|
119
|
+
ansibleVariables: {
|
120
|
+
totalCount: 23,
|
121
|
+
},
|
98
122
|
},
|
99
123
|
{
|
100
124
|
__typename: 'AnsibleRole',
|
101
125
|
id: 'MDE6QW5zaWJsZVJvbGUtNTg=',
|
102
126
|
name: 'geerlingguy.nfs',
|
103
127
|
path: '/ansible/ansible_roles/search="name = geerlingguy.nfs"',
|
128
|
+
ansibleVariables: {
|
129
|
+
totalCount: 23,
|
130
|
+
},
|
104
131
|
},
|
105
132
|
],
|
106
133
|
};
|
@@ -118,6 +145,9 @@ export const allRolesMocks = allAnsibleRolesMockFactory(
|
|
118
145
|
name: 'adriagalin.motd',
|
119
146
|
path: '/ansible/ansible_roles/search="name = adriagalin.motd"',
|
120
147
|
inherited: true,
|
148
|
+
ansibleVariables: {
|
149
|
+
totalCount: 23,
|
150
|
+
},
|
121
151
|
},
|
122
152
|
{ ...role1, inherited: false },
|
123
153
|
{ ...role2, inherited: false },
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
|
-
import { ListView
|
3
|
+
import { ListView } from 'patternfly-react';
|
4
|
+
import { Tooltip } from '@patternfly/react-core';
|
4
5
|
import classNames from 'classnames';
|
5
6
|
import { translate as __ } from 'foremanReact/common/I18n';
|
6
7
|
|
@@ -13,12 +14,6 @@ const AnsibleRole = ({ role, icon, onClick, resourceName, index }) => {
|
|
13
14
|
? __('This Ansible role is inherited from parent host group')
|
14
15
|
: __('This Ansible role is inherited from host group');
|
15
16
|
|
16
|
-
const tooltip = (
|
17
|
-
<Tooltip id={role.id}>
|
18
|
-
<span>{text}</span>
|
19
|
-
</Tooltip>
|
20
|
-
);
|
21
|
-
|
22
17
|
const clickHandler = (onClickFn, ansibleRole) => event => {
|
23
18
|
event.preventDefault();
|
24
19
|
onClickFn(ansibleRole);
|
@@ -48,11 +43,7 @@ const AnsibleRole = ({ role, icon, onClick, resourceName, index }) => {
|
|
48
43
|
);
|
49
44
|
|
50
45
|
if (role.inherited) {
|
51
|
-
return (
|
52
|
-
<OverlayTrigger overlay={tooltip} placement="top">
|
53
|
-
{listItem()}
|
54
|
-
</OverlayTrigger>
|
55
|
-
);
|
46
|
+
return <Tooltip content={<span>{text}</span>}>{listItem()}</Tooltip>;
|
56
47
|
}
|
57
48
|
|
58
49
|
return listItem(clickHandler);
|
@@ -1,22 +1,21 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { translate as __ } from 'foremanReact/common/I18n';
|
3
|
-
import { Tooltip
|
3
|
+
import { Tooltip } from '@patternfly/react-core';
|
4
|
+
import { InfoCircleIcon } from '@patternfly/react-icons';
|
4
5
|
|
5
6
|
const OrderedRolesTooltip = props => {
|
6
|
-
const
|
7
|
-
<
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
</span>
|
13
|
-
</Tooltip>
|
7
|
+
const content = (
|
8
|
+
<span>
|
9
|
+
{__(
|
10
|
+
'Use drag and drop to change order of the roles. Ordering of roles is respected for Ansible runs, inherited roles are always before those assigned directly'
|
11
|
+
)}
|
12
|
+
</span>
|
14
13
|
);
|
15
14
|
|
16
15
|
return (
|
17
|
-
<
|
18
|
-
<
|
19
|
-
</
|
16
|
+
<Tooltip content={content}>
|
17
|
+
<InfoCircleIcon style={{ marginRight: '10px' }} />
|
18
|
+
</Tooltip>
|
20
19
|
);
|
21
20
|
};
|
22
21
|
|
data/webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AnsibleRole.test.js.snap
CHANGED
@@ -65,25 +65,11 @@ exports[`AnsibleRole should render a role to remove 1`] = `
|
|
65
65
|
`;
|
66
66
|
|
67
67
|
exports[`AnsibleRole should render inherited role to remove 1`] = `
|
68
|
-
<
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
id={5}
|
74
|
-
placement="right"
|
75
|
-
>
|
76
|
-
<span>
|
77
|
-
This Ansible role is inherited from host group
|
78
|
-
</span>
|
79
|
-
</Tooltip>
|
80
|
-
}
|
81
|
-
placement="top"
|
82
|
-
trigger={
|
83
|
-
Array [
|
84
|
-
"hover",
|
85
|
-
"focus",
|
86
|
-
]
|
68
|
+
<Tooltip
|
69
|
+
content={
|
70
|
+
<span>
|
71
|
+
This Ansible role is inherited from host group
|
72
|
+
</span>
|
87
73
|
}
|
88
74
|
>
|
89
75
|
<ListViewItem
|
@@ -104,5 +90,5 @@ exports[`AnsibleRole should render inherited role to remove 1`] = `
|
|
104
90
|
onExpandClose={[Function]}
|
105
91
|
stacked={true}
|
106
92
|
/>
|
107
|
-
</
|
93
|
+
</Tooltip>
|
108
94
|
`;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_ansible
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 9.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Lobato Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: acts_as_list
|
@@ -109,11 +109,12 @@ files:
|
|
109
109
|
- app/graphql/types/ansible_variable_override.rb
|
110
110
|
- app/graphql/types/inherited_ansible_role.rb
|
111
111
|
- app/graphql/types/overriden_ansible_variable.rb
|
112
|
+
- app/helpers/foreman_ansible/ansible_hostgroups_helper.rb
|
112
113
|
- app/helpers/foreman_ansible/ansible_plugin_helper.rb
|
113
114
|
- app/helpers/foreman_ansible/ansible_reports_helper.rb
|
114
115
|
- app/helpers/foreman_ansible/ansible_roles_data_preparations.rb
|
115
116
|
- app/helpers/foreman_ansible/ansible_roles_helper.rb
|
116
|
-
- app/helpers/foreman_ansible/
|
117
|
+
- app/helpers/foreman_ansible/hosts_helper.rb
|
117
118
|
- app/jobs/sync_playbooks.rb
|
118
119
|
- app/jobs/sync_roles_and_variables.rb
|
119
120
|
- app/lib/actions/foreman_ansible/helpers/play_roles_description.rb
|
@@ -127,7 +128,6 @@ files:
|
|
127
128
|
- app/models/hostgroup_ansible_role.rb
|
128
129
|
- app/overrides/ansible_roles_tab.rb
|
129
130
|
- app/overrides/hostgroup_ansible_roles_tab.rb
|
130
|
-
- app/overrides/hostgroup_play_roles.rb
|
131
131
|
- app/overrides/report_output.rb
|
132
132
|
- app/services/foreman_ansible/ansible_info.rb
|
133
133
|
- app/services/foreman_ansible/ansible_report_importer.rb
|
@@ -171,7 +171,6 @@ files:
|
|
171
171
|
- app/views/api/v2/ansible_variables/show.json.rabl
|
172
172
|
- app/views/api/v2/hostgroups/ansible_roles.json.rabl
|
173
173
|
- app/views/api/v2/hosts/ansible_roles.json.rabl
|
174
|
-
- app/views/foreman_ansible/ansible_roles/_hostgroup_ansible_roles_button.erb
|
175
174
|
- app/views/foreman_ansible/ansible_roles/_select_tab_content.html.erb
|
176
175
|
- app/views/foreman_ansible/ansible_roles/_select_tab_title.html.erb
|
177
176
|
- app/views/foreman_ansible/api/v2/ansible_roles/import.json.rabl
|
@@ -186,7 +185,6 @@ files:
|
|
186
185
|
- app/views/foreman_ansible/job_templates/ansible_roles_-_install_from_git.erb
|
187
186
|
- app/views/foreman_ansible/job_templates/ansible_windows_updates.erb
|
188
187
|
- app/views/foreman_ansible/job_templates/capsule_upgrade_-_ansible_default.erb
|
189
|
-
- app/views/foreman_ansible/job_templates/configure_cloud_connector_-_ansible_default.erb
|
190
188
|
- app/views/foreman_ansible/job_templates/convert_to_rhel.erb
|
191
189
|
- app/views/foreman_ansible/job_templates/maintenance_plan.erb
|
192
190
|
- app/views/foreman_ansible/job_templates/module_action_-_ansible_default.erb
|
@@ -1,30 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ForemanAnsible
|
4
|
-
# Chained methods to extend the hosts menu with Ansible actions
|
5
|
-
module HostsHelperExtensions
|
6
|
-
extend ActiveSupport::Concern
|
7
|
-
|
8
|
-
module Overrides
|
9
|
-
def multiple_actions
|
10
|
-
actions = super
|
11
|
-
if User.current.can?(:create_job_invocations) &&
|
12
|
-
User.current.can?(:play_roles_on_host)
|
13
|
-
actions += [[_('Run all Ansible roles'),
|
14
|
-
multiple_play_roles_hosts_path,
|
15
|
-
false]]
|
16
|
-
end
|
17
|
-
actions
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
included do
|
22
|
-
prepend Overrides
|
23
|
-
end
|
24
|
-
|
25
|
-
def ansible_roles_present?(host)
|
26
|
-
host.ansible_roles.present? ||
|
27
|
-
host.inherited_ansible_roles.present?
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Displays Ansible roles button in host group action buttons
|
4
|
-
Deface::Override.new(
|
5
|
-
:virtual_path => 'hostgroups/index',
|
6
|
-
:name => 'hostgroup_ansible_roles_button',
|
7
|
-
:replace => "erb[loud]:contains('action_buttons')",
|
8
|
-
:partial => 'foreman_ansible/ansible_roles/hostgroup_ansible_roles_button'
|
9
|
-
)
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<%=
|
2
|
-
play_roles = if hostgroup.all_ansible_roles.empty?
|
3
|
-
link_to _('Run all Ansible roles'), 'javascript:void(0);', disabled: true, title: 'No Roles assigned'
|
4
|
-
else
|
5
|
-
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'))
|
6
|
-
end
|
7
|
-
|
8
|
-
assign_jobs = link_to(_("Configure Ansible Job"), "/ansible/hostgroups/#{hostgroup.id}", { class: 'la' })
|
9
|
-
|
10
|
-
actions = [
|
11
|
-
display_link_if_authorized(_('Nest'), hash_for_nest_hostgroup_path(:id => hostgroup)),
|
12
|
-
display_link_if_authorized(_('Clone'), hash_for_clone_hostgroup_path(:id => hostgroup))
|
13
|
-
]
|
14
|
-
actions.push play_roles if User.current.can?(:create_job_invocations)
|
15
|
-
actions.push assign_jobs if User.current.can?(:view_job_invocations) && User.current.can?(:view_recurring_logics)
|
16
|
-
actions.push display_delete_if_authorized(hash_for_hostgroup_path(:id => hostgroup).merge(:auth_object => hostgroup, :authorizer => authorizer), :data => { :confirm => warning_message(hostgroup) })
|
17
|
-
|
18
|
-
action_buttons(*actions)
|
19
|
-
%>
|
data/app/views/foreman_ansible/job_templates/configure_cloud_connector_-_ansible_default.erb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
name: Configure Cloud Connector
|
3
|
-
snippet: false
|
4
|
-
template_inputs:
|
5
|
-
- name: satellite_user
|
6
|
-
required: true
|
7
|
-
input_type: user
|
8
|
-
advanced: false
|
9
|
-
value_type: plain
|
10
|
-
hidden_value: false
|
11
|
-
- name: satellite_password
|
12
|
-
required: true
|
13
|
-
input_type: user
|
14
|
-
advanced: false
|
15
|
-
value_type: plain
|
16
|
-
hidden_value: true
|
17
|
-
- name: http_proxy
|
18
|
-
required: false
|
19
|
-
input_type: user
|
20
|
-
advanced: true
|
21
|
-
value_type: plain
|
22
|
-
hidden_value: false
|
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
|
-
model: JobTemplate
|
25
|
-
job_category: Maintenance Operations
|
26
|
-
description_format: "%{template_name}"
|
27
|
-
provider_type: Ansible
|
28
|
-
kind: job_template
|
29
|
-
feature: ansible_configure_cloud_connector
|
30
|
-
%>
|
31
|
-
|
32
|
-
---
|
33
|
-
- hosts: all
|
34
|
-
vars:
|
35
|
-
satellite_url: "<%= foreman_server_url %>"
|
36
|
-
roles:
|
37
|
-
- project-receptor.satellite_receptor_installer
|