foreman_ansible 9.0.1 → 10.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/foreman_ansible/ansible_hostgroups_helper.rb +1 -1
  3. data/lib/foreman_ansible/register.rb +1 -1
  4. data/lib/foreman_ansible/version.rb +1 -1
  5. data/package.json +0 -1
  6. data/test/integration/hostgroup_js_test.rb +30 -0
  7. data/webpack/components/AnsibleHostDetail/AnsibleHostDetail.js +1 -0
  8. data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/AnsibleVariableOverridesTable.js +10 -4
  9. data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/EditableAction.js +3 -0
  10. data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/EditableValueHelper.js +5 -1
  11. data/webpack/components/AnsibleHostDetail/components/JobsTab/NewRecurringJobModal.js +3 -0
  12. data/webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js +10 -4
  13. data/webpack/components/AnsibleHostDetail/components/JobsTab/RecurringJobsTable.js +3 -3
  14. data/webpack/components/AnsibleHostDetail/components/JobsTab/index.js +5 -1
  15. data/webpack/components/AnsibleHostDetail/components/RolesTab/AllRolesModal/AllRolesTable.js +10 -4
  16. data/webpack/components/AnsibleHostDetail/components/RolesTab/AllRolesModal/index.js +1 -0
  17. data/webpack/components/AnsibleHostDetail/components/RolesTab/EditRolesModal/EditRolesForm.js +2 -1
  18. data/webpack/components/AnsibleHostDetail/components/RolesTab/EditRolesModal/index.js +7 -1
  19. data/webpack/components/AnsibleHostDetail/components/RolesTab/RolesTable.js +14 -5
  20. data/webpack/components/AnsibleHostDetail/components/RolesTab/__test__/EditRoles.test.js +2 -1
  21. data/webpack/components/AnsibleHostDetail/components/RolesTab/__test__/RolesTab.test.js +3 -1
  22. data/webpack/components/AnsibleHostDetail/components/RolesTab/index.js +27 -2
  23. data/webpack/components/AnsibleHostDetail/components/SecondaryTabRoutes.js +1 -1
  24. data/webpack/testHelper.js +12 -3
  25. metadata +20 -56
  26. data/lib/foreman_ansible/register.rb.orig +0 -257
  27. data/locale/ca/foreman_ansible.edit.po +0 -1162
  28. data/locale/ca/foreman_ansible.po.time_stamp +0 -0
  29. data/locale/cs_CZ/foreman_ansible.edit.po +0 -1207
  30. data/locale/cs_CZ/foreman_ansible.po.time_stamp +0 -0
  31. data/locale/de/foreman_ansible.edit.po +0 -1148
  32. data/locale/de/foreman_ansible.po.time_stamp +0 -0
  33. data/locale/en/foreman_ansible.edit.po +0 -1146
  34. data/locale/en/foreman_ansible.po.time_stamp +0 -0
  35. data/locale/en_GB/foreman_ansible.edit.po +0 -1155
  36. data/locale/en_GB/foreman_ansible.po.time_stamp +0 -0
  37. data/locale/es/foreman_ansible.edit.po +0 -1148
  38. data/locale/es/foreman_ansible.po.time_stamp +0 -0
  39. data/locale/fr/foreman_ansible.edit.po +0 -1148
  40. data/locale/fr/foreman_ansible.po.time_stamp +0 -0
  41. data/locale/gl/foreman_ansible.edit.po +0 -1156
  42. data/locale/gl/foreman_ansible.po.time_stamp +0 -0
  43. data/locale/it/foreman_ansible.edit.po +0 -1148
  44. data/locale/it/foreman_ansible.po.time_stamp +0 -0
  45. data/locale/ja/foreman_ansible.edit.po +0 -1148
  46. data/locale/ja/foreman_ansible.po.time_stamp +0 -0
  47. data/locale/ko/foreman_ansible.edit.po +0 -1148
  48. data/locale/ko/foreman_ansible.po.time_stamp +0 -0
  49. data/locale/nl_NL/foreman_ansible.edit.po +0 -1168
  50. data/locale/nl_NL/foreman_ansible.po.time_stamp +0 -0
  51. data/locale/pl/foreman_ansible.edit.po +0 -1180
  52. data/locale/pl/foreman_ansible.po.time_stamp +0 -0
  53. data/locale/pt_BR/foreman_ansible.edit.po +0 -1148
  54. data/locale/pt_BR/foreman_ansible.po.time_stamp +0 -0
  55. data/locale/ru/foreman_ansible.edit.po +0 -1149
  56. data/locale/ru/foreman_ansible.po.time_stamp +0 -0
  57. data/locale/sv_SE/foreman_ansible.edit.po +0 -1180
  58. data/locale/sv_SE/foreman_ansible.po.time_stamp +0 -0
  59. data/locale/zh_CN/foreman_ansible.edit.po +0 -1148
  60. data/locale/zh_CN/foreman_ansible.po.time_stamp +0 -0
  61. data/locale/zh_TW/foreman_ansible.edit.po +0 -1148
  62. data/locale/zh_TW/foreman_ansible.po.time_stamp +0 -0
  63. data/webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js.orig +0 -151
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: 9.0.1
4
+ version: 10.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-09-05 00:00:00.000000000 Z
11
+ date: 2022-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_list
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 4.4.0
47
+ version: 8.0.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 4.4.0
54
+ version: 8.0.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: foreman-tasks
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: 5.2.0
61
+ version: 7.0.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: 5.2.0
68
+ version: 7.0.0
69
69
  description: Ansible integration with Foreman
70
70
  email:
71
71
  - elobatocs@gmail.com
@@ -222,85 +222,48 @@ files:
222
222
  - lib/foreman_ansible.rb
223
223
  - lib/foreman_ansible/engine.rb
224
224
  - lib/foreman_ansible/register.rb
225
- - lib/foreman_ansible/register.rb.orig
226
225
  - lib/foreman_ansible/remote_execution.rb
227
226
  - lib/foreman_ansible/version.rb
228
227
  - locale/Makefile
229
228
  - locale/action_names.rb
230
229
  - locale/ca/LC_MESSAGES/foreman_ansible.mo
231
- - locale/ca/foreman_ansible.edit.po
232
230
  - locale/ca/foreman_ansible.po
233
- - locale/ca/foreman_ansible.po.time_stamp
234
231
  - locale/cs_CZ/LC_MESSAGES/foreman_ansible.mo
235
- - locale/cs_CZ/foreman_ansible.edit.po
236
232
  - locale/cs_CZ/foreman_ansible.po
237
- - locale/cs_CZ/foreman_ansible.po.time_stamp
238
233
  - locale/de/LC_MESSAGES/foreman_ansible.mo
239
- - locale/de/foreman_ansible.edit.po
240
234
  - locale/de/foreman_ansible.po
241
- - locale/de/foreman_ansible.po.time_stamp
242
235
  - locale/en/LC_MESSAGES/foreman_ansible.mo
243
- - locale/en/foreman_ansible.edit.po
244
236
  - locale/en/foreman_ansible.po
245
- - locale/en/foreman_ansible.po.time_stamp
246
237
  - locale/en_GB/LC_MESSAGES/foreman_ansible.mo
247
- - locale/en_GB/foreman_ansible.edit.po
248
238
  - locale/en_GB/foreman_ansible.po
249
- - locale/en_GB/foreman_ansible.po.time_stamp
250
239
  - locale/es/LC_MESSAGES/foreman_ansible.mo
251
- - locale/es/foreman_ansible.edit.po
252
240
  - locale/es/foreman_ansible.po
253
- - locale/es/foreman_ansible.po.time_stamp
254
241
  - locale/foreman_ansible.pot
255
242
  - locale/fr/LC_MESSAGES/foreman_ansible.mo
256
- - locale/fr/foreman_ansible.edit.po
257
243
  - locale/fr/foreman_ansible.po
258
- - locale/fr/foreman_ansible.po.time_stamp
259
244
  - locale/gemspec.rb
260
245
  - locale/gl/LC_MESSAGES/foreman_ansible.mo
261
- - locale/gl/foreman_ansible.edit.po
262
246
  - locale/gl/foreman_ansible.po
263
- - locale/gl/foreman_ansible.po.time_stamp
264
247
  - locale/it/LC_MESSAGES/foreman_ansible.mo
265
- - locale/it/foreman_ansible.edit.po
266
248
  - locale/it/foreman_ansible.po
267
- - locale/it/foreman_ansible.po.time_stamp
268
249
  - locale/ja/LC_MESSAGES/foreman_ansible.mo
269
- - locale/ja/foreman_ansible.edit.po
270
250
  - locale/ja/foreman_ansible.po
271
- - locale/ja/foreman_ansible.po.time_stamp
272
251
  - locale/ko/LC_MESSAGES/foreman_ansible.mo
273
- - locale/ko/foreman_ansible.edit.po
274
252
  - locale/ko/foreman_ansible.po
275
- - locale/ko/foreman_ansible.po.time_stamp
276
253
  - locale/nl_NL/LC_MESSAGES/foreman_ansible.mo
277
- - locale/nl_NL/foreman_ansible.edit.po
278
254
  - locale/nl_NL/foreman_ansible.po
279
- - locale/nl_NL/foreman_ansible.po.time_stamp
280
255
  - locale/pl/LC_MESSAGES/foreman_ansible.mo
281
- - locale/pl/foreman_ansible.edit.po
282
256
  - locale/pl/foreman_ansible.po
283
- - locale/pl/foreman_ansible.po.time_stamp
284
257
  - locale/pt_BR/LC_MESSAGES/foreman_ansible.mo
285
- - locale/pt_BR/foreman_ansible.edit.po
286
258
  - locale/pt_BR/foreman_ansible.po
287
- - locale/pt_BR/foreman_ansible.po.time_stamp
288
259
  - locale/ru/LC_MESSAGES/foreman_ansible.mo
289
- - locale/ru/foreman_ansible.edit.po
290
260
  - locale/ru/foreman_ansible.po
291
- - locale/ru/foreman_ansible.po.time_stamp
292
261
  - locale/sv_SE/LC_MESSAGES/foreman_ansible.mo
293
- - locale/sv_SE/foreman_ansible.edit.po
294
262
  - locale/sv_SE/foreman_ansible.po
295
- - locale/sv_SE/foreman_ansible.po.time_stamp
296
263
  - locale/zh_CN/LC_MESSAGES/foreman_ansible.mo
297
- - locale/zh_CN/foreman_ansible.edit.po
298
264
  - locale/zh_CN/foreman_ansible.po
299
- - locale/zh_CN/foreman_ansible.po.time_stamp
300
265
  - locale/zh_TW/LC_MESSAGES/foreman_ansible.mo
301
- - locale/zh_TW/foreman_ansible.edit.po
302
266
  - locale/zh_TW/foreman_ansible.po
303
- - locale/zh_TW/foreman_ansible.po.time_stamp
304
267
  - package.json
305
268
  - test/factories/ansible_proxy.rb
306
269
  - test/factories/ansible_roles.rb
@@ -325,6 +288,7 @@ files:
325
288
  - test/graphql/mutations/hosts/assign_ansible_roles_mutation_test.rb
326
289
  - test/graphql/queries/ansible_roles_query_test.rb
327
290
  - test/graphql/queries/host_ansible_roles_query_test.rb
291
+ - test/integration/hostgroup_js_test.rb
328
292
  - test/test_plugin_helper.rb
329
293
  - test/unit/actions/run_ansible_job_test.rb
330
294
  - test/unit/actions/run_proxy_ansible_command_test.rb
@@ -374,7 +338,6 @@ files:
374
338
  - webpack/components/AnsibleHostDetail/components/JobsTab/NewRecurringJobModal.js
375
339
  - webpack/components/AnsibleHostDetail/components/JobsTab/NewRecurringJobModal.scss
376
340
  - webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js
377
- - webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js.orig
378
341
  - webpack/components/AnsibleHostDetail/components/JobsTab/RecurringJobsTable.js
379
342
  - webpack/components/AnsibleHostDetail/components/JobsTab/__test__/JobsTab.fixtures.js
380
343
  - webpack/components/AnsibleHostDetail/components/JobsTab/__test__/JobsTab.test.js
@@ -495,7 +458,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
495
458
  - !ruby/object:Gem::Version
496
459
  version: '0'
497
460
  requirements: []
498
- rubygems_version: 3.1.6
461
+ rubygems_version: 3.1.4
499
462
  signing_key:
500
463
  specification_version: 4
501
464
  summary: Ansible integration with Foreman (theforeman.org)
@@ -510,25 +473,34 @@ test_files:
510
473
  - test/fixtures/sample_facts.json
511
474
  - test/fixtures/sample_playbooks.json
512
475
  - test/foreman_ansible/helpers/ansible_roles_helper_test.rb
476
+ - test/functional/ansible_roles_controller_test.rb
477
+ - test/functional/ansible_variables_controller_test.rb
513
478
  - test/functional/api/v2/ansible_inventories_controller_test.rb
514
479
  - test/functional/api/v2/ansible_playbooks_controller_test.rb
515
480
  - test/functional/api/v2/ansible_roles_controller_test.rb
516
481
  - test/functional/api/v2/ansible_variables_controller_test.rb
517
482
  - test/functional/api/v2/hostgroups_controller_test.rb
518
483
  - test/functional/api/v2/hosts_controller_test.rb
519
- - test/functional/ansible_roles_controller_test.rb
520
- - test/functional/ansible_variables_controller_test.rb
521
484
  - test/functional/hosts_controller_test.rb
522
485
  - test/functional/ui_ansible_roles_controller_test.rb
523
486
  - test/graphql/mutations/hosts/assign_ansible_roles_mutation_test.rb
524
487
  - test/graphql/queries/ansible_roles_query_test.rb
525
488
  - test/graphql/queries/host_ansible_roles_query_test.rb
489
+ - test/test_plugin_helper.rb
526
490
  - test/unit/actions/run_ansible_job_test.rb
527
491
  - test/unit/actions/run_proxy_ansible_command_test.rb
492
+ - test/unit/ansible_provider_test.rb
493
+ - test/unit/ansible_role_test.rb
494
+ - test/unit/ansible_variable_test.rb
528
495
  - test/unit/concerns/config_reports_extensions_test.rb
529
496
  - test/unit/concerns/host_managed_extensions_test.rb
530
497
  - test/unit/concerns/hostgroup_extensions_test.rb
531
498
  - test/unit/helpers/ansible_reports_helper_test.rb
499
+ - test/unit/host_ansible_role_test.rb
500
+ - test/unit/hostgroup_ansible_role_test.rb
501
+ - test/unit/ignore_roles_test.rb
502
+ - test/unit/import_playbooks_test.rb
503
+ - test/unit/import_roles_and_variables.rb
532
504
  - test/unit/lib/proxy_api/ansible_test.rb
533
505
  - test/unit/services/ansible_report_importer_test.rb
534
506
  - test/unit/services/ansible_variables_importer_test.rb
@@ -538,12 +510,4 @@ test_files:
538
510
  - test/unit/services/override_resolver_test.rb
539
511
  - test/unit/services/roles_importer_test.rb
540
512
  - test/unit/services/ui_roles_importer_test.rb
541
- - test/unit/ansible_provider_test.rb
542
- - test/unit/ansible_role_test.rb
543
- - test/unit/ansible_variable_test.rb
544
- - test/unit/host_ansible_role_test.rb
545
- - test/unit/hostgroup_ansible_role_test.rb
546
- - test/unit/ignore_roles_test.rb
547
- - test/unit/import_playbooks_test.rb
548
- - test/unit/import_roles_and_variables.rb
549
- - test/test_plugin_helper.rb
513
+ - test/integration/hostgroup_js_test.rb
@@ -1,257 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Foreman::Plugin.register :foreman_ansible do
4
- requires_foreman '>= 3.3'
5
-
6
- settings do
7
- category :ansible, N_('Ansible') do
8
- setting 'ansible_ssh_private_key_file',
9
- type: :string,
10
- description: N_('Use this to supply a path to an SSH Private Key '\
11
- 'that Ansible will use in lieu of a password '\
12
- 'Override with "ansible_ssh_private_key_file" '\
13
- 'host parameter'),
14
- default: '',
15
- full_name: N_('Private Key Path')
16
- setting 'ansible_connection',
17
- type: :string,
18
- description: N_('Use this connection type by default when running '\
19
- 'Ansible playbooks. You can override this on hosts by '\
20
- 'adding a parameter "ansible_connection"'),
21
- default: 'ssh',
22
- full_name: N_('Connection type')
23
- setting 'ansible_winrm_server_cert_validation',
24
- type: :string,
25
- description: N_('Enable/disable WinRM server certificate '\
26
- 'validation when running Ansible playbooks. You can override '\
27
- 'this on hosts by adding a parameter '\
28
- '"ansible_winrm_server_cert_validation"'),
29
- default: 'validate',
30
- full_name: N_('WinRM cert Validation')
31
- setting 'ansible_verbosity',
32
- type: :integer,
33
- description: N_('Foreman will add this level of verbosity for '\
34
- 'additional debugging output when running Ansible playbooks.'),
35
- default: '0',
36
- full_name: N_('Default verbosity level'),
37
- value: nil,
38
- collection: proc {
39
- { '0' => N_('Disabled'),
40
- '1' => N_('Level 1 (-v)'),
41
- '2' => N_('Level 2 (-vv)'),
42
- '3' => N_('Level 3 (-vvv)'),
43
- '4' => N_('Level 4 (-vvvv)') }
44
- }
45
- setting 'ansible_post_provision_timeout',
46
- type: :integer,
47
- description: N_('Timeout (in seconds) to set when Foreman will trigger a '\
48
- 'play Ansible roles task after a host is fully provisioned. '\
49
- 'Set this to the maximum time you expect a host to take '\
50
- 'until it is ready after a reboot.'),
51
- default: '360',
52
- full_name: N_('Post-provision timeout')
53
- setting 'ansible_interval',
54
- type: :integer,
55
- description: N_('Timeout (in minutes) when hosts should have reported.'),
56
- default: '30',
57
- full_name: N_('Ansible report timeout')
58
- setting 'ansible_out_of_sync_disabled',
59
- type: :boolean,
60
- description: format(N_('Disable host configuration status turning to out of'\
61
- ' sync for %{cfgmgmt} after report does not arrive within'\
62
- ' configured interval'), :cfgmgmt => 'Ansible'),
63
- default: false,
64
- full_name: format(N_('%{cfgmgmt} out of sync disabled'), :cfgmgmt => 'Ansible')
65
- setting 'ansible_inventory_template',
66
- type: :string,
67
- description: N_('Foreman will use this template to schedule the report '\
68
- 'with Ansible inventory'),
69
- default: 'Ansible - Ansible Inventory',
70
- full_name: N_('Default Ansible inventory report template')
71
- setting 'ansible_roles_to_ignore',
72
- type: :array,
73
- description: N_('Those roles will be excluded when importing roles from smart proxy, '\
74
- 'The expected input is comma separated values and you can use * wildcard metacharacters'\
75
- 'For example: foo*, *b*,*bar'),
76
- default: [],
77
- full_name: N_('Ansible roles to ignore')
78
- setting 'foreman_ansible_proxy_batch_size',
79
- type: :integer,
80
- description: N_('Number of tasks which should be sent to the smart proxy in one request, '\
81
- 'if foreman_tasks_proxy_batch_trigger is enabled. '\
82
- 'If set, overrides foreman_tasks_proxy_batch_size setting for Ansible jobs.'),
83
- default: nil,
84
- full_name: N_('Proxy tasks batch size for Ansible')
85
- end
86
- end
87
-
88
- security_block :foreman_ansible do
89
- permission :play_roles_on_host,
90
- { :hosts => [:play_roles, :multiple_play_roles],
91
- :'api/v2/hosts' => [:play_roles,
92
- :multiple_play_roles] },
93
- :resource_type => 'Host'
94
- permission :play_roles_on_hostgroup,
95
- { :hostgroups => [:play_roles],
96
- :'api/v2/hostgroups' => [:play_roles,
97
- :multiple_play_roles] },
98
- :resource_type => 'Hostgroup'
99
- permission :view_ansible_roles,
100
- { :ansible_roles => [:index, :auto_complete_search],
101
- :'api/v2/ansible_roles' => [:index, :show, :fetch],
102
- :ui_ansible_roles => [:index] },
103
- :resource_type => 'AnsibleRole'
104
- permission :destroy_ansible_roles,
105
- { :ansible_roles => [:destroy],
106
- :'api/v2/ansible_roles' => [:destroy, :obsolete] },
107
- :resource_type => 'AnsibleRole'
108
- permission :import_ansible_roles,
109
- { :ansible_roles => [:import, :confirm_import],
110
- :'api/v2/ansible_roles' => [:import, :sync] },
111
- :resource_type => 'AnsibleRole'
112
- permission :view_ansible_variables,
113
- {
114
- :lookup_values => [:index],
115
- :ansible_variables => [:index, :auto_complete_search],
116
- :'api/v2/ansible_variables' => [:index, :show]
117
- },
118
- :resource_type => 'AnsibleVariable'
119
- permission :edit_ansible_variables,
120
- { :lookup_values => [:update],
121
- :ansible_variables => [:edit, :update],
122
- :'api/v2/ansible_variables' => [:update],
123
- :'api/v2/ansible_override_values' => [:create, :destroy] },
124
- :resource_type => 'AnsibleVariable'
125
- permission :destroy_ansible_variables,
126
- {
127
- :lookup_values => [:destroy],
128
- :ansible_variables => [:destroy],
129
- :'api/v2/ansible_variables' => [:destroy, :obsolete]
130
- },
131
- :resource_type => 'AnsibleVariable'
132
- permission :create_ansible_variables,
133
- {
134
- :lookup_values => [:create],
135
- :ansible_variables => [:new, :create],
136
- :'api/v2/ansible_variables' => [:create]
137
- },
138
- :resource_type => 'AnsibleVariable'
139
- permission :import_ansible_variables,
140
- {
141
- :ansible_variables => [:import, :confirm_import],
142
- :'api/v2/ansible_variables' => [:import]
143
- },
144
- :resource_type => 'AnsibleVariable'
145
- permission :view_hosts,
146
- { :'api/v2/hosts' => [:ansible_roles],
147
- :'api/v2/ansible_inventories' => [:hosts] },
148
- :resource_type => 'Host'
149
- permission :view_hostgroups,
150
- { :'api/v2/hostgroups' => [:ansible_roles],
151
- :'api/v2/ansible_inventories' => [:hostgroups] },
152
- :resource_type => 'Hostgroup'
153
- permission :edit_hosts,
154
- { :'api/v2/hosts' => [:assign_ansible_roles] },
155
- :resource_type => 'Host'
156
- permission :edit_hostgroups,
157
- { :'api/v2/hostgroups' => [:assign_ansible_roles] },
158
- :resource_type => 'Hostgroup'
159
- permission :generate_ansible_inventory,
160
- { :'api/v2/ansible_inventories' => [:schedule] }
161
- permission :import_ansible_playbooks,
162
- { :'api/v2/ansible_playbooks' => [:sync, :fetch] }
163
- end
164
-
165
- role 'Ansible Roles Manager',
166
- [:play_roles_on_host, :play_roles_on_hostgroup,
167
- :create_job_invocations, :view_job_templates, # to allow the play_roles
168
- :create_template_invocations, :view_smart_proxies, # ...
169
- :view_ansible_roles, :destroy_ansible_roles,
170
- :import_ansible_roles, :view_ansible_variables,
171
- :create_ansible_variables, :import_ansible_variables,
172
- :edit_ansible_variables, :destroy_ansible_variables, :import_ansible_playbooks]
173
-
174
- role 'Ansible Tower Inventory Reader',
175
- [:view_hosts, :view_hostgroups, :view_facts, :generate_report_templates, :generate_ansible_inventory,
176
- :view_report_templates],
177
- 'Permissions required for the user which is used by Ansible Tower Dynamic Inventory Item'
178
-
179
- add_all_permissions_to_default_roles
180
- extend_template_helpers ForemanAnsible::RendererMethods
181
- allowed_template_helpers :insights_remediation
182
-
183
- base_role_assignment_params = { :ansible_role_ids => [],
184
- :ansible_roles => [] }
185
- parameter_filter Host::Managed, base_role_assignment_params.merge(:host_ansible_roles_attributes => {})
186
- parameter_filter Hostgroup, base_role_assignment_params.merge(:hostgroup_ansible_roles_attributes => {})
187
-
188
- register_global_js_file 'global'
189
-
190
- extend_graphql_type :type => '::Types::Host' do
191
- field :all_ansible_roles, ::Types::InheritedAnsibleRole.connection_type, :null => true, :method => :present_all_ansible_roles
192
- field :own_ansible_roles, ::Types::AnsibleRole.connection_type, :null => true
193
- field :available_ansible_roles, ::Types::AnsibleRole.connection_type, :null => true
194
- field :ansible_variables_with_overrides, Types::OverridenAnsibleVariable.connection_type, :null => false
195
-
196
- def present_all_ansible_roles
197
- inherited_ansible_roles = object.inherited_ansible_roles.map { |role| ::Presenters::AnsibleRolePresenter.new(role, true) }
198
- ansible_roles = object.ansible_roles.map { |role| ::Presenters::AnsibleRolePresenter.new(role, false) }
199
- (inherited_ansible_roles + ansible_roles).uniq
200
- end
201
-
202
- def ansible_variables_with_overrides
203
- resolver = ::ForemanAnsible::OverrideResolver.new(object)
204
- AnsibleVariable.where(:ansible_role_id => object.all_ansible_roles.pluck(:id), :override => true).map { |variable| ::Presenters::OverridenAnsibleVariablePresenter.new variable, resolver }
205
- end
206
- end
207
-
208
- register_graphql_query_field :ansible_roles, '::Types::AnsibleRole', :collection_field
209
- register_graphql_mutation_field :assign_ansible_roles, '::Mutations::Hosts::AssignAnsibleRoles'
210
- register_graphql_mutation_field :delete_ansible_variable_override, ::Mutations::AnsibleVariableOverrides::Delete
211
- register_graphql_mutation_field :update_ansible_variable_override, ::Mutations::AnsibleVariableOverrides::Update
212
- register_graphql_mutation_field :create_ansible_variable_override, ::Mutations::AnsibleVariableOverrides::Create
213
-
214
- divider :top_menu, :caption => N_('Ansible'), :parent => :configure_menu
215
- menu :top_menu, :ansible_roles,
216
- :caption => N_('Roles'),
217
- :url_hash => { :controller => :ansible_roles, :action => :index },
218
- :parent => :configure_menu
219
- menu :top_menu, :ansible_variables,
220
- :caption => N_('Variables'),
221
- :url_hash => { :controller => :ansible_variables, :action => :index },
222
- :parent => :configure_menu
223
-
224
- apipie_documented_controllers [
225
- "#{ForemanAnsible::Engine.root}/app/controllers/api/v2/*.rb"
226
- ]
227
- ApipieDSL.configuration.dsl_classes_matchers += [
228
- "#{ForemanAnsible::Engine.root}/app/models/*.rb",
229
- "#{ForemanAnsible::Engine.root}/app/services/foreman_ansible/*.rb"
230
- ]
231
-
232
- register_info_provider ForemanAnsible::AnsibleInfo
233
-
234
- # For backwards compatiblity with 1.17
235
- if respond_to?(:register_report_scanner)
236
- register_report_scanner ForemanAnsible::AnsibleReportScanner
237
- register_report_origin 'Ansible', 'ConfigReport'
238
- end
239
-
240
- <<<<<<< HEAD
241
- describe_host do
242
- multiple_actions_provider :ansible_hosts_multiple_actions
243
- =======
244
- extend_page('smart_proxies/show') do |context|
245
- context.add_pagelet :smart_proxy_title_actions,
246
- :name => _('Update Smart Proxy'),
247
- :partial => 'foreman/smart_proxies/update_smart_proxy',
248
- :onlyif => ->(proxy, view) { view.can_update_proxy?(proxy) }
249
- end
250
- extend_page('smart_proxies/index') do |context|
251
- context.add_pagelet :smart_proxy_title_actions,
252
- :name => _('Update Smart Proxy'),
253
- :partial => 'foreman/smart_proxies/update_smart_proxy',
254
- :onlyif => ->(proxy, view) { view.can_update_proxy?(proxy) }
255
- >>>>>>> a707dab (Fixes #35143 - Add a smart proxy update button)
256
- end
257
- end