foreman_ansible 2.2.14 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -0
- data/app/controllers/ansible_roles_controller.rb +4 -11
- data/app/controllers/ansible_variables_controller.rb +80 -0
- data/app/controllers/api/v2/ansible_roles_controller.rb +2 -0
- data/app/controllers/api/v2/ansible_variables_controller.rb +68 -0
- data/app/controllers/concerns/foreman/controller/parameters/ansible_variable.rb +36 -0
- data/app/controllers/foreman_ansible/api/v2/hostgroups_controller_extensions.rb +2 -0
- data/app/controllers/foreman_ansible/api/v2/hostgroups_param_group_extensions.rb +2 -0
- data/app/controllers/foreman_ansible/api/v2/hosts_controller_extensions.rb +2 -0
- data/app/controllers/foreman_ansible/api/v2/hosts_param_group_extensions.rb +2 -0
- data/app/controllers/foreman_ansible/concerns/hostgroups_controller_extensions.rb +2 -0
- data/app/controllers/foreman_ansible/concerns/hosts_controller_extensions.rb +2 -0
- data/app/controllers/foreman_ansible/concerns/import_controller_helper.rb +24 -0
- data/app/controllers/foreman_ansible/concerns/job_invocation_helper.rb +2 -0
- data/app/helpers/foreman_ansible/ansible_plugin_helper.rb +2 -0
- data/app/helpers/foreman_ansible/ansible_reports_helper.rb +6 -4
- data/app/helpers/foreman_ansible/ansible_roles_helper.rb +2 -0
- data/app/helpers/foreman_ansible/hosts_helper_extensions.rb +2 -0
- data/app/lib/actions/foreman_ansible/helpers/host_common.rb +2 -0
- data/app/lib/actions/foreman_ansible/helpers/play_roles_description.rb +2 -0
- data/app/lib/proxy_api/ansible.rb +16 -0
- data/app/models/ansible_role.rb +5 -0
- data/app/models/ansible_variable.rb +23 -0
- data/app/models/concerns/foreman_ansible/host_managed_extensions.rb +3 -1
- data/app/models/concerns/foreman_ansible/hostgroup_extensions.rb +2 -0
- data/app/models/foreman_ansible/ansible_provider.rb +2 -0
- data/app/models/foreman_ansible/fact_name.rb +2 -0
- data/app/models/host_ansible_role.rb +2 -0
- data/app/models/hostgroup_ansible_role.rb +2 -0
- data/app/models/setting/ansible.rb +7 -5
- data/app/overrides/ansible_roles_tab.rb +2 -0
- data/app/overrides/ansible_variables_edit.rb +15 -0
- data/app/overrides/hostgroup_ansible_roles_tab.rb +2 -0
- data/app/overrides/hostgroup_play_roles.rb +2 -0
- data/app/overrides/report_output.rb +2 -0
- data/app/services/foreman_ansible/ansible_report_importer.rb +15 -0
- data/app/services/foreman_ansible/ansible_report_scanner.rb +2 -0
- data/app/services/foreman_ansible/api_roles_importer.rb +2 -0
- data/app/services/foreman_ansible/fact_importer.rb +2 -0
- data/app/services/foreman_ansible/fact_parser.rb +13 -1
- data/app/services/foreman_ansible/fact_sparser.rb +2 -0
- data/app/services/foreman_ansible/insights_notification_builder.rb +2 -0
- data/app/services/foreman_ansible/insights_plan_runner.rb +3 -2
- data/app/services/foreman_ansible/inventory_creator.rb +0 -6
- data/app/services/foreman_ansible/operating_system_parser.rb +3 -1
- data/app/services/foreman_ansible/playbook_creator.rb +2 -0
- data/app/services/foreman_ansible/proxy_api.rb +24 -0
- data/app/services/foreman_ansible/renderer_methods.rb +2 -0
- data/app/services/foreman_ansible/roles_importer.rb +4 -17
- data/app/services/foreman_ansible/structured_fact_importer.rb +2 -0
- data/app/services/foreman_ansible/ui_roles_importer.rb +2 -0
- data/app/services/foreman_ansible/variables_importer.rb +100 -0
- data/app/views/ansible_roles/index.html.erb +13 -3
- data/app/views/ansible_variables/_ansible_roles_list.html.erb +15 -0
- data/app/views/ansible_variables/_validator_text.html.erb +5 -0
- data/app/views/ansible_variables/edit.html.erb +17 -0
- data/app/views/ansible_variables/import.html.erb +53 -0
- data/app/views/ansible_variables/index.html.erb +46 -0
- data/app/views/api/v2/ansible_roles/import.json.rabl +2 -0
- data/app/views/api/v2/ansible_roles/index.json.rabl +2 -0
- data/app/views/api/v2/ansible_roles/obsolete.json.rabl +2 -0
- data/app/views/api/v2/ansible_roles/show.json.rabl +2 -0
- data/app/views/api/v2/ansible_variables/import.json.rabl +3 -0
- data/app/views/api/v2/ansible_variables/index.json.rabl +3 -0
- data/app/views/api/v2/ansible_variables/obsolete.json.rabl +3 -0
- data/app/views/api/v2/ansible_variables/show.json.rabl +20 -0
- data/app/views/foreman_ansible/api/v2/ansible_roles/import.json.rabl +2 -0
- data/app/views/foreman_ansible/api/v2/ansible_roles/index.json.rabl +2 -0
- data/app/views/foreman_ansible/api/v2/ansible_roles/obsolete.json.rabl +2 -0
- data/app/views/foreman_ansible/api/v2/ansible_roles/show.json.rabl +2 -0
- data/config/routes.rb +17 -0
- data/db/migrate/20160705082036_create_ansible_role.rb +2 -0
- data/db/migrate/20160706074540_create_join_table_hosts_ansible_roles.rb +2 -0
- data/db/migrate/20160707195442_create_host_ansible_roles.rb +2 -0
- data/db/migrate/20160729094457_add_columns_to_ansible_role.rb +2 -0
- data/db/migrate/20160802153302_create_join_table_hostgroup_ansible_roles.rb +2 -0
- data/db/migrate/20160805094233_add_primary_key_hostgroup_ansible_roles.rb +2 -0
- data/db/migrate/20161122154057_automatically_set_role_timestamps.rb +2 -0
- data/db/migrate/20180410125416_rename_ansible_job_categories.rb +6 -3
- data/db/migrate/20180628125416_add_ansible_role_id_to_lookup_keys.rb +14 -0
- data/db/seeds.d/62_ansible_proxy_feature.rb +2 -0
- data/db/seeds.d/75_job_templates.rb +3 -1
- data/db/seeds.d/90_notification_blueprints.rb +2 -0
- data/lib/foreman_ansible.rb +2 -0
- data/lib/foreman_ansible/engine.rb +2 -0
- data/lib/foreman_ansible/register.rb +28 -1
- data/lib/foreman_ansible/remote_execution.rb +2 -0
- data/lib/foreman_ansible/version.rb +3 -1
- data/locale/action_names.rb +2 -2
- data/locale/de/LC_MESSAGES/foreman_ansible.mo +0 -0
- data/locale/de/foreman_ansible.edit.po +444 -0
- data/locale/de/foreman_ansible.po +56 -17
- data/locale/de/foreman_ansible.po.time_stamp +0 -0
- data/locale/en/LC_MESSAGES/foreman_ansible.mo +0 -0
- data/locale/en/foreman_ansible.edit.po +442 -0
- data/locale/en/foreman_ansible.po +56 -17
- data/locale/en/foreman_ansible.po.time_stamp +0 -0
- data/locale/es/LC_MESSAGES/foreman_ansible.mo +0 -0
- data/locale/es/foreman_ansible.edit.po +444 -0
- data/locale/es/foreman_ansible.po +56 -17
- data/locale/es/foreman_ansible.po.time_stamp +0 -0
- data/locale/foreman_ansible.pot +174 -93
- data/locale/fr/LC_MESSAGES/foreman_ansible.mo +0 -0
- data/locale/fr/foreman_ansible.edit.po +444 -0
- data/locale/fr/foreman_ansible.po +56 -17
- data/locale/fr/foreman_ansible.po.time_stamp +0 -0
- data/locale/it/LC_MESSAGES/foreman_ansible.mo +0 -0
- data/locale/it/foreman_ansible.edit.po +444 -0
- data/locale/it/foreman_ansible.po +56 -17
- data/locale/it/foreman_ansible.po.time_stamp +0 -0
- data/locale/ja/LC_MESSAGES/foreman_ansible.mo +0 -0
- data/locale/ja/foreman_ansible.edit.po +444 -0
- data/locale/ja/foreman_ansible.po +56 -17
- data/locale/ja/foreman_ansible.po.time_stamp +0 -0
- data/locale/ko/LC_MESSAGES/foreman_ansible.mo +0 -0
- data/locale/ko/foreman_ansible.edit.po +444 -0
- data/locale/ko/foreman_ansible.po +56 -17
- data/locale/ko/foreman_ansible.po.time_stamp +0 -0
- data/locale/pt_BR/LC_MESSAGES/foreman_ansible.mo +0 -0
- data/locale/pt_BR/foreman_ansible.edit.po +444 -0
- data/locale/pt_BR/foreman_ansible.po +56 -17
- data/locale/pt_BR/foreman_ansible.po.time_stamp +0 -0
- data/locale/ru/LC_MESSAGES/foreman_ansible.mo +0 -0
- data/locale/ru/foreman_ansible.edit.po +445 -0
- data/locale/ru/foreman_ansible.po +56 -17
- data/locale/ru/foreman_ansible.po.time_stamp +0 -0
- data/locale/zh_CN/LC_MESSAGES/foreman_ansible.mo +0 -0
- data/locale/zh_CN/foreman_ansible.edit.po +444 -0
- data/locale/zh_CN/foreman_ansible.po +56 -17
- data/locale/zh_CN/foreman_ansible.po.time_stamp +0 -0
- data/locale/zh_TW/LC_MESSAGES/foreman_ansible.mo +0 -0
- data/locale/zh_TW/foreman_ansible.edit.po +444 -0
- data/locale/zh_TW/foreman_ansible.po +56 -17
- data/locale/zh_TW/foreman_ansible.po.time_stamp +0 -0
- data/test/factories/ansible_proxy.rb +2 -0
- data/test/factories/ansible_roles.rb +2 -0
- data/test/factories/ansible_variables.rb +8 -0
- data/test/functional/ansible_roles_controller_test.rb +2 -0
- data/test/functional/ansible_variables_controller_test.rb +36 -0
- data/test/functional/api/v2/ansible_roles_controller_test.rb +21 -9
- data/test/functional/api/v2/ansible_variables_controller_test.rb +41 -0
- data/test/functional/api/v2/hostgroups_controller_test.rb +2 -0
- data/test/functional/api/v2/hosts_controller_test.rb +2 -0
- data/test/functional/hosts_controller_test.rb +2 -0
- data/test/test_plugin_helper.rb +2 -0
- data/test/unit/ansible_provider_test.rb +2 -0
- data/test/unit/ansible_role_test.rb +5 -9
- data/test/unit/ansible_variable_test.rb +14 -0
- data/test/unit/concerns/config_reports_extensions_test.rb +2 -0
- data/test/unit/concerns/host_managed_extensions_test.rb +2 -0
- data/test/unit/concerns/hostgroup_extensions_test.rb +2 -0
- data/test/unit/helpers/ansible_reports_helper_test.rb +2 -0
- data/test/unit/host_ansible_role_test.rb +2 -0
- data/test/unit/hostgroup_ansible_role_test.rb +2 -0
- data/test/unit/lib/foreman_ansible_core/command_creator_test.rb +2 -0
- data/test/unit/lib/foreman_ansible_core/playbook_runner_test.rb +2 -0
- data/test/unit/lib/proxy_api/ansible_test.rb +2 -0
- data/test/unit/services/ansible_report_importer_test.rb +15 -0
- data/test/unit/services/ansible_variables_importer_test.rb +39 -0
- data/test/unit/services/api_roles_importer_test.rb +2 -0
- data/test/unit/services/fact_importer_test.rb +2 -0
- data/test/unit/services/fact_parser_test.rb +47 -0
- data/test/unit/services/fact_sparser_test.rb +2 -0
- data/test/unit/services/insights_plan_runner_test.rb +2 -0
- data/test/unit/services/inventory_creator_test.rb +1 -13
- data/test/unit/services/roles_importer_test.rb +2 -0
- data/test/unit/services/structured_fact_importer_test.rb +2 -0
- data/test/unit/services/ui_roles_importer_test.rb +2 -0
- metadata +101 -42
- data/test/unit/lib/foreman_ansible_core/roles_reader_test.rb +0 -92
@@ -18,12 +18,22 @@
|
|
18
18
|
<tr>
|
19
19
|
<td class="ellipsis"><%= role.name %></td>
|
20
20
|
<td class="ellipsis"><%= role.hostgroups.count %></td>
|
21
|
-
<td class="ellipsis"><%= link_to role.hosts.count, hosts_path(:search => "
|
21
|
+
<td class="ellipsis"><%= link_to role.hosts.count, hosts_path(:search => "role = #{role.name}")%></td>
|
22
22
|
<td class="ellipsis"><%= import_time role %></td>
|
23
23
|
<td>
|
24
24
|
<%
|
25
|
-
|
26
|
-
|
25
|
+
links = [
|
26
|
+
link_to(
|
27
|
+
_('Variables'),
|
28
|
+
ansible_variables_path(:search => "ansible_role = #{role}")
|
29
|
+
),
|
30
|
+
display_delete_if_authorized(
|
31
|
+
hash_for_ansible_role_path(:id => role).
|
32
|
+
merge(:auth_object => role, :authorizer => authorizer),
|
33
|
+
:data => { :confirm => _("Delete %s?") % role.name },
|
34
|
+
:action => :delete
|
35
|
+
)
|
36
|
+
]
|
27
37
|
%>
|
28
38
|
<%= action_buttons(*links) %>
|
29
39
|
</td>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% if f.object.is_a? ::AnsibleVariable %>
|
2
|
+
<%=
|
3
|
+
select_f(
|
4
|
+
f,
|
5
|
+
:ansible_role_id,
|
6
|
+
[f.object.ansible_role],
|
7
|
+
:id,
|
8
|
+
:to_label,
|
9
|
+
{},
|
10
|
+
{ :label => _("Ansible Role"), :disabled => true }
|
11
|
+
)
|
12
|
+
%>
|
13
|
+
<% else %>
|
14
|
+
<%= show_puppet_class(f) %>
|
15
|
+
<% end %>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<% if f.object.is_a? ::AnsibleVariable %>
|
2
|
+
<h6><%= _('Before including these variables on your playbooks, Foreman will validate that your variables comply with the validation.') %></h6>
|
3
|
+
<% else %>
|
4
|
+
<h6><%= _('If ERB is used in a parameter value, the validation of the value will happen during the ENC request. If the value is invalid, the ENC request will fail.') %></h6>
|
5
|
+
<% end %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%= breadcrumbs(
|
2
|
+
:items => [
|
3
|
+
{
|
4
|
+
:caption => _('Ansible Variables'),
|
5
|
+
:url => url_for(ansible_variables_path)
|
6
|
+
},
|
7
|
+
{
|
8
|
+
:caption => _('Edit %s' % @ansible_variable.key)
|
9
|
+
}
|
10
|
+
],
|
11
|
+
:switchable => false
|
12
|
+
) %>
|
13
|
+
<% title(_('Edit Ansible Variable')) %>
|
14
|
+
<%= form_for(@ansible_variable) do |f| %>
|
15
|
+
<%= render 'lookup_keys/fields', :f => f %>
|
16
|
+
<%= submit_or_cancel f %>
|
17
|
+
<% end %>
|
@@ -0,0 +1,53 @@
|
|
1
|
+
<% title _("Changed Ansible variables") %>
|
2
|
+
<%= form_tag confirm_import_ansible_variables_path do %>
|
3
|
+
<h4><%= _("Select the changes you want to realize in Foreman") %></h4>
|
4
|
+
<h6>
|
5
|
+
<%= _("Toggle") %>:
|
6
|
+
<%= link_to_function(icon_text("check", _("New")),
|
7
|
+
"toggleCheckboxesBySelector('.variable_select_boxes_new')",
|
8
|
+
:title => _("Check/Uncheck new")) %> |
|
9
|
+
<%= link_to_function(icon_text("check", _("Obsolete")),
|
10
|
+
"toggleCheckboxesBySelector('.variable_select_boxes_obsolete')",
|
11
|
+
:title => _("Check/Uncheck obsolete")) %>
|
12
|
+
</h6>
|
13
|
+
<table class="<%= table_css_classes %>">
|
14
|
+
<thead>
|
15
|
+
<tr>
|
16
|
+
<th class="ca">
|
17
|
+
<%= link_to_function(icon_text("check"),
|
18
|
+
"toggleCheckboxesBySelector('.variable_select_boxes')",
|
19
|
+
:title => _("Check/Uncheck all")) %>
|
20
|
+
</th>
|
21
|
+
<th><%= _("Name") %></th>
|
22
|
+
<th><%= _("Ansible role") %></th>
|
23
|
+
<th class="col-md-2"><%= _("Hosts count") %></th>
|
24
|
+
<th class="col-md-2"><%= _("Hostgroups count") %></th>
|
25
|
+
<th><%= _("Operation") %></th>
|
26
|
+
</tr>
|
27
|
+
</thead>
|
28
|
+
<tbody>
|
29
|
+
<% changed.each do |kind, variables| %>
|
30
|
+
<% variables.each do |variable| %>
|
31
|
+
<tr>
|
32
|
+
<td>
|
33
|
+
<%= check_box_tag "changed[#{kind}][#{variable.ansible_role}][#{variable}]", variable.to_json, false, :class => "variable_select_boxes variable_select_boxes_#{kind} variable_select_boxes_variable_#{variable}" %>
|
34
|
+
</td>
|
35
|
+
<td>
|
36
|
+
<%= link_to_function("#{variable}", "toggleCheckboxesBySelector('.variable_select_boxes_variable_#{variable}')", :title => _("Check/Uncheck all %s changes") % variable) %>
|
37
|
+
</td>
|
38
|
+
<td><%= variable.ansible_role %></td>
|
39
|
+
<td><%= variable.ansible_role.hosts.count %></td>
|
40
|
+
<td><%= variable.ansible_role.hostgroups.count %></td>
|
41
|
+
<td>
|
42
|
+
<%= { "new" => _("Add"), "obsolete" => _("Remove") }[kind] %>
|
43
|
+
</td>
|
44
|
+
</tr>
|
45
|
+
<% end %>
|
46
|
+
<% end %>
|
47
|
+
</tbody>
|
48
|
+
</table>
|
49
|
+
<div>
|
50
|
+
<%= link_to _("Cancel"), ansible_variables_path, :class => "btn btn-default" %>
|
51
|
+
<%= submit_tag _("Update"), :class => "btn btn-primary" %>
|
52
|
+
</div>
|
53
|
+
<% end %>
|
@@ -0,0 +1,46 @@
|
|
1
|
+
<% title _("Ansible Variables") %>
|
2
|
+
|
3
|
+
<% title_actions ansible_proxy_import(hash_for_import_ansible_variables_path),
|
4
|
+
documentation_button('#4.3Variables', :root_url => ansible_doc_url) %>
|
5
|
+
|
6
|
+
<table class="<%= table_css_classes 'table-fixed' %>">
|
7
|
+
<thead>
|
8
|
+
<tr>
|
9
|
+
<th class='col-md-6'><%= sort :name, :as => s_('Variable|Name') %></th>
|
10
|
+
<th class='col-md-2'><%= sort :ansible_role, :as => s_('Variable|Role') %></th>
|
11
|
+
<th class='col-md-2'><%= _('Type') %></th>
|
12
|
+
<th class='col-md-2'><%= _('Actions') %></th>
|
13
|
+
</tr>
|
14
|
+
</thead>
|
15
|
+
<tbody>
|
16
|
+
<% @ansible_variables.each do |variable| %>
|
17
|
+
<tr>
|
18
|
+
<td class="ellipsis"><%= link_to_if_authorized(
|
19
|
+
variable.key,
|
20
|
+
hash_for_edit_ansible_variable_path(:id => variable).
|
21
|
+
merge(:auth_object => variable,
|
22
|
+
:permission => 'edit_external_parameters',
|
23
|
+
:authorizer => authorizer)
|
24
|
+
) %></td>
|
25
|
+
<td class="ellipsis"><%= link_to_if_authorized(
|
26
|
+
variable.ansible_role.name,
|
27
|
+
hash_for_ansible_variables_path(:search => "ansible_role = #{variable.ansible_role}")
|
28
|
+
) %></td>
|
29
|
+
<td class="ellipsis"><%= "String" %></td>
|
30
|
+
<td class="ellipsis">
|
31
|
+
<% links = [
|
32
|
+
display_delete_if_authorized(
|
33
|
+
hash_for_ansible_variable_path(:id => variable.id).merge(
|
34
|
+
:auth_object => variable,
|
35
|
+
:authorizer => authorizer),
|
36
|
+
:data => { :confirm => _("Delete %s?") % variable.key },
|
37
|
+
:action => :delete)
|
38
|
+
] %>
|
39
|
+
<%= action_buttons(*links) %>
|
40
|
+
</td>
|
41
|
+
</tr>
|
42
|
+
<% end %>
|
43
|
+
</tbody>
|
44
|
+
</table>
|
45
|
+
|
46
|
+
<%= will_paginate_with_info @ansible_variables %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
object @ansible_variable
|
2
|
+
|
3
|
+
attribute :parameter
|
4
|
+
attributes :id, :ansible_role, :description, :override, :parameter_type,
|
5
|
+
:hidden_value?, :omit, :required, :validator_type, :validator_rule,
|
6
|
+
:merge_overrides, :merge_default, :avoid_duplicates,
|
7
|
+
:override_value_order, :created_at, :updated_at
|
8
|
+
|
9
|
+
node do |ansible_variable|
|
10
|
+
{
|
11
|
+
:override_values => partial(
|
12
|
+
'api/v2/override_values/index',
|
13
|
+
:object => ansible_variable.lookup_values
|
14
|
+
)
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
node :override_values_count do |lk|
|
19
|
+
lk.lookup_values.count
|
20
|
+
end
|
data/config/routes.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# rubocop:disable BlockLength
|
2
4
|
Rails.application.routes.draw do
|
3
5
|
namespace :api do
|
@@ -47,6 +49,14 @@ Rails.application.routes.draw do
|
|
47
49
|
end
|
48
50
|
|
49
51
|
resources :ansible_roles, :only => [:index, :destroy] do
|
52
|
+
collection do
|
53
|
+
get :import
|
54
|
+
post :confirm_import
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
resources :ansible_variables, :except => [:show, :new, :create] do
|
59
|
+
resources :lookup_values, :only => [:index, :create, :update, :destroy]
|
50
60
|
collection do
|
51
61
|
get :import
|
52
62
|
post :confirm_import
|
@@ -68,6 +78,13 @@ Rails.application.routes.draw do
|
|
68
78
|
get :fetch
|
69
79
|
end
|
70
80
|
end
|
81
|
+
|
82
|
+
resources :ansible_variables, :only => [:show, :index, :destroy] do
|
83
|
+
collection do
|
84
|
+
put :import
|
85
|
+
put :obsolete
|
86
|
+
end
|
87
|
+
end
|
71
88
|
end
|
72
89
|
end
|
73
90
|
end
|
@@ -1,7 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Rename ansible job categories migration
|
1
4
|
class RenameAnsibleJobCategories < ActiveRecord::Migration[5.1]
|
2
5
|
def up
|
3
|
-
unless User.unscoped.
|
4
|
-
puts
|
6
|
+
unless User.unscoped.find_by(:login => User::ANONYMOUS_ADMIN)
|
7
|
+
STDOUT.puts 'No ANONYMOUS_ADMIN found. Skipping renaming Ansible jobs'
|
5
8
|
return
|
6
9
|
end
|
7
10
|
User.as_anonymous_admin do
|
@@ -16,7 +19,7 @@ class RenameAnsibleJobCategories < ActiveRecord::Migration[5.1]
|
|
16
19
|
job_template.job_category = "Ansible #{job_template.job_category}"
|
17
20
|
job_template.save
|
18
21
|
end
|
19
|
-
|
22
|
+
|
20
23
|
service_template = JobTemplate.where(
|
21
24
|
:name => 'Service Action - Ansible Default'
|
22
25
|
).first
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# to keep track of when the roles were imported
|
4
|
+
class AddAnsibleRoleIdToLookupKeys < ActiveRecord::Migration[4.2]
|
5
|
+
def up
|
6
|
+
add_column :lookup_keys, :ansible_role_id, :integer
|
7
|
+
add_index :lookup_keys, :ansible_role_id
|
8
|
+
end
|
9
|
+
|
10
|
+
def down
|
11
|
+
remove_index :lookup_keys, :ansible_role_id
|
12
|
+
remove_column :lookup_keys, :ansible_role_id
|
13
|
+
end
|
14
|
+
end
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
organizations = Organization.unscoped.all
|
2
4
|
locations = Location.unscoped.all
|
3
5
|
User.as_anonymous_admin do
|
4
6
|
RemoteExecutionFeature.without_auditing do
|
5
|
-
if Rails.env.test? ||
|
7
|
+
if Rails.env.test? || Foreman.in_rake?
|
6
8
|
# If this file tries to import a template with a REX feature in a SeedsTest,
|
7
9
|
# it will fail - the REX feature isn't registered on SeedsTest because
|
8
10
|
# DatabaseCleaner truncates the db before every test.
|
data/lib/foreman_ansible.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# rubocop:disable BlockLength
|
2
4
|
Foreman::Plugin.register :foreman_ansible do
|
3
5
|
requires_foreman '>= 1.16'
|
@@ -14,7 +16,7 @@ Foreman::Plugin.register :foreman_ansible do
|
|
14
16
|
:multiple_play_roles] },
|
15
17
|
:resource_type => 'Hostgroup'
|
16
18
|
permission :view_ansible_roles,
|
17
|
-
{ :ansible_roles => [:index
|
19
|
+
{ :ansible_roles => [:index],
|
18
20
|
:'api/v2/ansible_roles' => [:index, :show, :fetch] },
|
19
21
|
:resource_type => 'AnsibleRole'
|
20
22
|
permission :destroy_ansible_roles,
|
@@ -25,6 +27,27 @@ Foreman::Plugin.register :foreman_ansible do
|
|
25
27
|
{ :ansible_roles => [:import, :confirm_import],
|
26
28
|
:'api/v2/ansible_roles' => [:import] },
|
27
29
|
:resource_type => 'AnsibleRole'
|
30
|
+
permission :view_ansible_variables,
|
31
|
+
{
|
32
|
+
:ansible_variables => [:index, :auto_complete_search],
|
33
|
+
:'api/v2/ansible_variables' => [:index, :show]
|
34
|
+
},
|
35
|
+
:resource_type => 'AnsibleVariable'
|
36
|
+
permission :edit_ansible_variables,
|
37
|
+
{ :ansible_variables => [:edit, :update] },
|
38
|
+
:resource_type => 'AnsibleVariable'
|
39
|
+
permission :destroy_ansible_variables,
|
40
|
+
{
|
41
|
+
:ansible_variables => [:destroy],
|
42
|
+
:'api/v2/ansible_variables' => [:destroy, :obsolete]
|
43
|
+
},
|
44
|
+
:resource_type => 'AnsibleVariable'
|
45
|
+
permission :import_ansible_variables,
|
46
|
+
{
|
47
|
+
:ansible_variables => [:import, :confirm_import],
|
48
|
+
:'api/v2/ansible_variables' => [:import]
|
49
|
+
},
|
50
|
+
:resource_type => 'AnsibleVariable'
|
28
51
|
permission :view_hosts,
|
29
52
|
{ :'api/v2/hosts' => [:ansible_roles] },
|
30
53
|
:resource_type => 'Host'
|
@@ -52,6 +75,10 @@ Foreman::Plugin.register :foreman_ansible do
|
|
52
75
|
:caption => N_('Roles'),
|
53
76
|
:url_hash => { :controller => :ansible_roles, :action => :index },
|
54
77
|
:parent => :configure_menu
|
78
|
+
menu :top_menu, :ansible_variables,
|
79
|
+
:caption => N_('Variables'),
|
80
|
+
:url_hash => { :controller => :ansible_variables, :action => :index },
|
81
|
+
:parent => :configure_menu
|
55
82
|
|
56
83
|
apipie_documented_controllers [
|
57
84
|
"#{ForemanAnsible::Engine.root}/app/controllers/api/v2/*.rb"
|