foreman_acd 0.2.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +107 -56
- data/app/controllers/foreman_acd/ansible_playbooks_controller.rb +199 -0
- data/app/controllers/foreman_acd/api/v2/ansible_playbooks_controller.rb +72 -0
- data/app/controllers/foreman_acd/api/v2/app_definitions_controller.rb +1 -0
- data/app/controllers/foreman_acd/api/v2/app_instances_controller.rb +62 -0
- data/app/controllers/foreman_acd/app_definitions_controller.rb +19 -10
- data/app/controllers/foreman_acd/app_instances_controller.rb +111 -137
- data/app/controllers/foreman_acd/concerns/ansible_playbook_parameters.rb +23 -0
- data/app/controllers/foreman_acd/concerns/app_definition_parameters.rb +1 -1
- data/app/controllers/foreman_acd/concerns/app_instance_parameters.rb +1 -1
- data/app/controllers/foreman_acd/remote_execution_controller.rb +62 -0
- data/app/controllers/ui_acd_controller.rb +20 -3
- data/app/lib/actions/foreman_acd/deploy_all_hosts.rb +47 -0
- data/app/lib/actions/foreman_acd/run_configurator.rb +44 -0
- data/app/models/concerns/foreman_acd/host_managed_extensions.rb +51 -0
- data/app/models/foreman_acd/acd_provider.rb +36 -0
- data/app/models/foreman_acd/ansible_playbook.rb +68 -0
- data/app/models/foreman_acd/app_definition.rb +25 -0
- data/app/models/foreman_acd/app_instance.rb +42 -0
- data/app/models/foreman_acd/foreman_host.rb +23 -0
- data/app/models/foreman_acd/taxonomy_extensions.rb +17 -0
- data/app/services/foreman_acd/acd_proxy_proxy_selector.rb +17 -0
- data/app/services/foreman_acd/app_configurator.rb +98 -0
- data/app/services/foreman_acd/app_deployer.rb +157 -0
- data/app/services/foreman_acd/inventory_creator.rb +68 -0
- data/app/views/foreman_acd/ansible_playbooks/_form.html.erb +64 -0
- data/app/views/foreman_acd/ansible_playbooks/edit.html.erb +11 -0
- data/app/views/foreman_acd/ansible_playbooks/index.html.erb +30 -0
- data/app/views/foreman_acd/ansible_playbooks/new.html.erb +3 -0
- data/app/views/foreman_acd/api/v2/ansible_playbooks/base.json.rabl +5 -0
- data/app/views/foreman_acd/api/v2/ansible_playbooks/index.json.rabl +5 -0
- data/app/views/foreman_acd/api/v2/ansible_playbooks/show.json.rabl +9 -0
- data/app/views/foreman_acd/api/v2/app_definitions/base.json.rabl +5 -0
- data/app/views/foreman_acd/api/v2/app_definitions/index.json.rabl +5 -0
- data/app/views/foreman_acd/api/v2/app_definitions/show.json.rabl +9 -0
- data/app/views/foreman_acd/api/v2/app_instances/base.json.rabl +5 -0
- data/app/views/foreman_acd/api/v2/app_instances/index.json.rabl +5 -0
- data/app/views/foreman_acd/api/v2/app_instances/show.json.rabl +5 -0
- data/app/views/foreman_acd/app_definitions/_form.html.erb +34 -12
- data/app/views/foreman_acd/app_definitions/edit.html.erb +10 -0
- data/app/views/foreman_acd/app_definitions/index.html.erb +4 -4
- data/app/views/foreman_acd/app_instances/_form.html.erb +11 -9
- data/app/views/foreman_acd/app_instances/edit.html.erb +10 -0
- data/app/views/foreman_acd/app_instances/index.html.erb +89 -10
- data/app/views/foreman_acd/app_instances/report.html.erb +6 -3
- data/app/views/templates/job/run_acd_ansible_playbook.erb +62 -0
- data/app/views/ui_acd/ansible_data.json.rabl +6 -0
- data/app/views/ui_acd/app.json.rabl +6 -2
- data/app/views/ui_acd/app_definition.json.rabl +1 -1
- data/app/views/ui_acd/{fdata.json.rabl → foreman_data.json.rabl} +1 -1
- data/config/routes.rb +32 -2
- data/db/migrate/20200916091018_create_ansible_playbooks.rb +20 -0
- data/db/migrate/20200917120220_add_ansible_playbook_id.rb +14 -0
- data/db/migrate/20201016002819_add_ansible_vars_all_to_app_definitions.rb +8 -0
- data/db/migrate/20201016104338_add_ansible_vars_all_to_app_instances.rb +8 -0
- data/db/migrate/20210112111548_add_organization_to_app_instance.rb +22 -0
- data/db/migrate/20210112113853_add_location_to_app_instance.rb +8 -0
- data/db/migrate/20210202141658_create_foreman_hosts.rb +24 -0
- data/db/migrate/20210204111306_remove_hosts_from_app_instances.rb +8 -0
- data/db/migrate/20210209091014_rename_acd_tables.rb +16 -0
- data/db/migrate/20210216083522_add_last_progress_report.rb +8 -0
- data/db/migrate/20210216091529_add_last_deploy_task.rb +8 -0
- data/db/migrate/20210316151145_add_git_commit_to_ansible_playbooks.rb +8 -0
- data/db/migrate/20210503122809_add_git_url_to_ansible_playbooks.rb +8 -0
- data/db/seeds.d/62_acd_proxy_feature.rb +4 -0
- data/db/seeds.d/75-job_templates.rb +13 -0
- data/lib/foreman_acd.rb +12 -0
- data/lib/foreman_acd/engine.rb +43 -3
- data/lib/foreman_acd/plugin.rb +88 -22
- data/lib/foreman_acd/version.rb +1 -1
- data/lib/tasks/foreman_acd_tasks.rake +0 -12
- data/locale/en/foreman_acd.edit.po +326 -0
- data/locale/en/foreman_acd.po +232 -2
- data/locale/en/foreman_acd.po.time_stamp +0 -0
- data/locale/foreman_acd.pot +343 -8
- data/package.json +9 -9
- data/test/controllers/ansible_playbooks_controller_test.rb +27 -0
- data/test/controllers/app_instances_controller_test.rb +8 -3
- data/test/controllers/ui_acd_controller_test.rb +22 -6
- data/test/factories/foreman_acd_factories.rb +18 -4
- data/test/models/acd_provider_test.rb +37 -0
- data/test/models/ansible_playbook_test.rb +11 -0
- data/test/models/app_definition_test.rb +1 -1
- data/test/models/app_instance_test.rb +2 -0
- data/test/models/concerns/host_extensions_test.rb +26 -0
- data/test/models/foreman_host_test.rb +12 -0
- data/webpack/__mocks__/foremanReact/API.js +2 -0
- data/webpack/__mocks__/foremanReact/common/I18n.js +3 -0
- data/webpack/__mocks__/foremanReact/common/helpers.js +2 -0
- data/webpack/__mocks__/foremanReact/components/ForemanModal.js +7 -0
- data/webpack/__mocks__/foremanReact/components/common/forms/CommonForm.js +2 -0
- data/webpack/__mocks__/foremanReact/components/common/forms/TextInput.js +2 -0
- data/webpack/__mocks__/foremanReact/components/hosts/powerStatus.js +1 -0
- data/webpack/__snapshots__/helper.test.js.snap +14 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinition.js +159 -29
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +106 -14
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +8 -2
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionHelper.js +26 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +143 -21
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +3 -0
- data/webpack/components/ApplicationDefinition/__fixtures__/applicationDefinitionConfData_1.fixtures.js +288 -0
- data/webpack/components/ApplicationDefinition/__fixtures__/applicationDefinitionReducer.fixtures.js +79 -0
- data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinition.test.js +25 -0
- data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionReducer.test.js +119 -0
- data/webpack/components/ApplicationDefinition/__tests__/ApplicationDefinitionSelectors.test.js +41 -0
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinition.test.js.snap +200 -0
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionReducer.test.js.snap +3033 -0
- data/webpack/components/ApplicationDefinition/__tests__/__snapshots__/ApplicationDefinitionSelectors.test.js.snap +299 -0
- data/webpack/components/ApplicationDefinition/components/AnsiblePlaybookSelector.js +50 -0
- data/webpack/components/ApplicationDefinition/components/__tests__/AnsiblePlaybookSelector.test.js +41 -0
- data/webpack/components/ApplicationDefinition/components/__tests__/__snapshots__/AnsiblePlaybookSelector.test.js.snap +121 -0
- data/webpack/components/ApplicationDefinition/index.js +6 -0
- data/webpack/components/ApplicationInstance/ApplicationInstance.js +151 -44
- data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +47 -10
- data/webpack/components/ApplicationInstance/ApplicationInstanceConstants.js +5 -2
- data/webpack/components/ApplicationInstance/ApplicationInstanceReducer.js +114 -28
- data/webpack/components/ApplicationInstance/ApplicationInstanceSelectors.js +3 -1
- data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceConfData_1.fixtures.js +263 -0
- data/webpack/components/ApplicationInstance/__fixtures__/applicationInstanceReducer.fixtures.js +78 -0
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstance.test.js +23 -0
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceReducer.test.js +119 -0
- data/webpack/components/ApplicationInstance/__tests__/ApplicationInstanceSelectors.test.js +44 -0
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstance.test.js.snap +209 -0
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceReducer.test.js.snap +2719 -0
- data/webpack/components/ApplicationInstance/__tests__/__snapshots__/ApplicationInstanceSelectors.test.js.snap +276 -0
- data/webpack/components/ApplicationInstance/components/Service.js +1 -1
- data/webpack/components/ApplicationInstance/index.js +4 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.js +53 -60
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReport.scss +17 -0
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportActions.js +7 -51
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportConstants.js +2 -4
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportReducer.js +4 -18
- data/webpack/components/ApplicationInstanceReport/ApplicationInstanceReportSelectors.js +0 -1
- data/webpack/components/ApplicationInstanceReport/__fixtures__/applicationInstanceReportData_1.fixtures.js +349 -0
- data/webpack/components/ApplicationInstanceReport/__fixtures__/applicationInstanceReportReducer.fixtures.js +20 -0
- data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReport.test.js +47 -0
- data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReportReducer.test.js +41 -0
- data/webpack/components/ApplicationInstanceReport/__tests__/ApplicationInstanceReportSelectors.test.js +26 -0
- data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReport.test.js.snap +130 -0
- data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReportReducer.test.js.snap +718 -0
- data/webpack/components/ApplicationInstanceReport/__tests__/__snapshots__/ApplicationInstanceReportSelectors.test.js.snap +347 -0
- data/webpack/components/ApplicationInstanceReport/components/ReportViewer.js +1 -1
- data/webpack/components/ApplicationInstanceReport/components/__tests__/ReportViewer.test.js +24 -0
- data/webpack/components/ApplicationInstanceReport/components/__tests__/__snapshots__/ReportViewer.test.js.snap +24 -0
- data/webpack/components/ApplicationInstanceReport/index.js +0 -2
- data/webpack/components/ParameterSelection/ParameterSelection.js +85 -50
- data/webpack/components/ParameterSelection/ParameterSelectionActions.js +68 -62
- data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +6 -3
- data/webpack/components/ParameterSelection/ParameterSelectionHelper.js +0 -32
- data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +47 -35
- data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +2 -2
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionData_1.fixtures.js +116 -84
- data/webpack/components/ParameterSelection/__fixtures__/parameterSelectionReducer.fixtures.js +10 -4
- data/webpack/components/ParameterSelection/__tests__/ParameterSelection.test.js +36 -46
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionReducer.test.js +31 -25
- data/webpack/components/ParameterSelection/__tests__/ParameterSelectionSelectors.test.js +6 -6
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelection.test.js.snap +2 -126
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionReducer.test.js.snap +1483 -872
- data/webpack/components/ParameterSelection/__tests__/__snapshots__/ParameterSelectionSelectors.test.js.snap +117 -79
- data/webpack/components/ParameterSelection/index.js +4 -4
- data/webpack/components/SyncGitRepo/SyncGitRepo.js +210 -0
- data/webpack/components/SyncGitRepo/SyncGitRepo.scss +1 -0
- data/webpack/components/SyncGitRepo/SyncGitRepoActions.js +124 -0
- data/webpack/components/SyncGitRepo/SyncGitRepoConstants.js +9 -0
- data/webpack/components/SyncGitRepo/SyncGitRepoReducer.js +80 -0
- data/webpack/components/SyncGitRepo/SyncGitRepoSelectors.js +6 -0
- data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoConfData_1.fixtures.js +7 -0
- data/webpack/components/SyncGitRepo/__fixtures__/syncGitRepoReducer.fixtures.js +44 -0
- data/webpack/components/SyncGitRepo/__tests__/SyncGitRepo.test.js +27 -0
- data/webpack/components/SyncGitRepo/__tests__/SyncGitRepoReducer.test.js +95 -0
- data/webpack/components/SyncGitRepo/__tests__/SyncGitRepoSelectors.test.js +32 -0
- data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepo.test.js.snap +30 -0
- data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepoReducer.test.js.snap +137 -0
- data/webpack/components/SyncGitRepo/__tests__/__snapshots__/SyncGitRepoSelectors.test.js.snap +13 -0
- data/webpack/components/SyncGitRepo/components/FormTextInput.js +42 -0
- data/webpack/components/SyncGitRepo/components/ScmTypeSelector.js +46 -0
- data/webpack/components/SyncGitRepo/index.js +28 -0
- data/webpack/components/common/DeleteTableEntry.js +3 -3
- data/webpack/components/common/EditTableEntry.js +50 -0
- data/webpack/components/common/ExtTextInput.js +43 -0
- data/webpack/components/common/LockTableEntry.js +60 -0
- data/webpack/components/common/__tests__/EditTableEntry.test.js +53 -0
- data/webpack/components/common/__tests__/LockTableEntry.test.js +35 -0
- data/webpack/components/common/__tests__/__snapshots__/DeleteTableEntry.test.js.snap +2 -2
- data/webpack/components/common/__tests__/__snapshots__/EditTableEntry.test.js.snap +81 -0
- data/webpack/components/common/__tests__/__snapshots__/LockTableEntry.test.js.snap +60 -0
- data/webpack/helper.js +15 -1
- data/webpack/helper.test.js +37 -0
- data/webpack/index.js +2 -0
- data/webpack/reducer.js +18 -11
- metadata +184 -10
- data/app/views/foreman_acd/app_instances/deploy.html.erb +0 -19
- data/webpack/components/common/__tests__/__snapshots__/AddParameter.test.js.snap +0 -35
- data/webpack/components/common/__tests__/__snapshots__/DeleteParameter.test.js.snap +0 -41
@@ -0,0 +1,11 @@
|
|
1
|
+
<%=
|
2
|
+
breadcrumbs(:resource_url => "/acd/api/v2/ansible_playbooks",
|
3
|
+
:items => [
|
4
|
+
{ :caption => _('Ansible Playbooks'),
|
5
|
+
:url => url_for(ansible_playbooks_path) },
|
6
|
+
{ :caption => "Edit #{@ansible_playbook.name}",
|
7
|
+
:url => (edit_ansible_playbook_path(@ansible_playbook) if authorized_for(hash_for_edit_ansible_playbook_path(@ansible_playbook))) }
|
8
|
+
])
|
9
|
+
%>
|
10
|
+
<% title(_('Edit Ansible Playbook %s') % @ansible_playbook) %>
|
11
|
+
<%= render :partial => 'form' %>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<% title _('Ansible Playbooks') %>
|
2
|
+
|
3
|
+
<% title_actions button_group(
|
4
|
+
new_link(_('New Ansible Playbook')),
|
5
|
+
) %>
|
6
|
+
|
7
|
+
<table class="table table-bordered table-striped">
|
8
|
+
<tr>
|
9
|
+
<th><%= sort :name, :as => s_('AnsiblePlaybook|Name') %></th>
|
10
|
+
<th><%= _('Description') %></th>
|
11
|
+
<th></th>
|
12
|
+
</tr>
|
13
|
+
<% for ansible_playbook in @ansible_playbooks %>
|
14
|
+
<tr>
|
15
|
+
<td><%=link_to_if_authorized h(ansible_playbook.name), hash_for_edit_ansible_playbook_path(:id => ansible_playbook) %></td>
|
16
|
+
<td><%= ansible_playbook.description %></td>
|
17
|
+
<td>
|
18
|
+
<%= action_buttons(
|
19
|
+
display_link_if_authorized(_("Import groups"), hash_for_import_vars_ansible_playbook_path(:id => ansible_playbook)),
|
20
|
+
display_delete_if_authorized(hash_for_ansible_playbook_path(:id => ansible_playbook),
|
21
|
+
:data => { 'confirm': _('Delete %s?') % ansible_playbook.name })
|
22
|
+
) %>
|
23
|
+
</td>
|
24
|
+
</tr>
|
25
|
+
<% end %>
|
26
|
+
</table>
|
27
|
+
|
28
|
+
<%= page_entries_info @ansible_playbooks %>
|
29
|
+
<%= will_paginate @ansible_playbooks %>
|
30
|
+
|
@@ -1,21 +1,41 @@
|
|
1
1
|
<%
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
2
|
+
json = {
|
3
|
+
"organization": current_organization,
|
4
|
+
"location": current_location,
|
5
|
+
"hostgroups": @hostgroups,
|
6
|
+
"foremanDataUrl": ui_acd_foreman_data_path("__id__"),
|
7
|
+
"ansibleDataUrl": ui_acd_ansible_data_path("__id__"),
|
8
|
+
"services": [],
|
9
|
+
"ansibleVarsAll": [],
|
10
|
+
}
|
11
|
+
|
12
|
+
if @app_definition.new_record?
|
13
|
+
json["mode"] = "newDefinition"
|
14
|
+
json["ansiblePlaybooks"] = @ansible_playbooks
|
15
|
+
else
|
16
|
+
json["mode"] = "editDefinition"
|
17
|
+
json["ansiblePlaybook"] = @app_definition.ansible_playbook.as_unified_structobj
|
18
|
+
end
|
19
|
+
|
20
|
+
if @app_definition.services.present?
|
21
|
+
json["services"] = JSON.parse(@app_definition.services)
|
22
|
+
end
|
23
|
+
|
24
|
+
if @app_definition.ansible_vars_all.present?
|
25
|
+
json["ansibleVarsAll"] = JSON.parse(@app_definition.ansible_vars_all)
|
26
|
+
end
|
13
27
|
%>
|
14
28
|
|
15
29
|
<%= form_for @app_definition, :url => (@app_definition.new_record? ? app_definitions_path : app_definition_path(:id => @app_definition.id)) do |f| %>
|
16
30
|
<%= base_errors_for @app_definition %>
|
17
31
|
<ul class="nav nav-tabs" data-tabs="tabs">
|
18
32
|
<li class="active"><a href="#primary" data-toggle="tab"><%= _('Application Definitions') %></a></li>
|
33
|
+
<% if show_location_tab? %>
|
34
|
+
<li><a href="#locations" data-toggle="tab"><%= _("Locations") %></a></li>
|
35
|
+
<% end %>
|
36
|
+
<% if show_organization_tab? %>
|
37
|
+
<li><a href="#organizations" data-toggle="tab"><%= _("Organizations") %></a></li>
|
38
|
+
<% end %>
|
19
39
|
</ul>
|
20
40
|
|
21
41
|
<div class="tab-content">
|
@@ -24,8 +44,10 @@
|
|
24
44
|
<%= text_f f, :description %>
|
25
45
|
|
26
46
|
<div id='app_definition'></div>
|
27
|
-
<%=
|
47
|
+
<%= react_component('ApplicationDefinition', :data => json) %>
|
28
48
|
</div>
|
49
|
+
|
50
|
+
<%= render 'taxonomies/loc_org_tabs', :f => f, :obj => @app_definition %>
|
29
51
|
</div>
|
30
52
|
|
31
53
|
<%= submit_or_cancel f %>
|
@@ -1,3 +1,13 @@
|
|
1
|
+
<%=
|
2
|
+
breadcrumbs(:resource_url => "/acd/api/v2/app_definitions",
|
3
|
+
:items => [
|
4
|
+
{ :caption => _('App Definitions'),
|
5
|
+
:url => url_for(app_definitions_path) },
|
6
|
+
{ :caption => "Edit #{@app_definition.name}",
|
7
|
+
:url => (edit_app_definition_path(@app_definition) if authorized_for(hash_for_edit_app_definition_path(@app_definition))) }
|
8
|
+
])
|
9
|
+
%>
|
10
|
+
|
1
11
|
<% title(_('Edit Application Definition %s') % @app_definition) %>
|
2
12
|
|
3
13
|
<% content_for(:javascripts) do %>
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
<% title_actions button_group(
|
4
4
|
new_link(_('New Application Definition')),
|
5
|
-
display_link_if_authorized(_("Import"), hash_for_import_app_definitions_path, :class => 'btn btn-default')
|
5
|
+
display_link_if_authorized(_("Import"), hash_for_import_app_definitions_path, :class => 'btn btn-default', :style => "display: none;")
|
6
6
|
) %>
|
7
7
|
|
8
8
|
<table class="table table-bordered table-striped">
|
@@ -13,13 +13,13 @@
|
|
13
13
|
</tr>
|
14
14
|
<% for app_definition in @app_definitions %>
|
15
15
|
<tr>
|
16
|
-
<td><%=link_to_if_authorized h(app_definition.name), hash_for_edit_app_definition_path(:id => app_definition)
|
16
|
+
<td><%=link_to_if_authorized h(app_definition.name), hash_for_edit_app_definition_path(:id => app_definition) %></td>
|
17
17
|
<td><%= app_definition.description %></td>
|
18
18
|
<td>
|
19
19
|
<%= action_buttons(
|
20
|
-
display_delete_if_authorized(hash_for_app_definition_path(:id => app_definition)
|
20
|
+
display_delete_if_authorized(hash_for_app_definition_path(:id => app_definition),
|
21
21
|
:data => { 'confirm': _('Delete %s?') % app_definition.name }),
|
22
|
-
display_link_if_authorized(_("Export"), hash_for_export_app_definition_path(:id => app_definition)
|
22
|
+
# TODO: add export feature again if app-def + ansible playbook can be exported together display_link_if_authorized(_("Export"), hash_for_export_app_definition_path(:id => app_definition))
|
23
23
|
) %>
|
24
24
|
</td>
|
25
25
|
</tr>
|
@@ -1,25 +1,27 @@
|
|
1
1
|
<%
|
2
|
-
if @app_instance.
|
2
|
+
if @app_instance.new_record?
|
3
3
|
json = {
|
4
4
|
"mode": "newInstance",
|
5
5
|
"organization": current_organization,
|
6
6
|
"location": current_location,
|
7
7
|
"applications": @applications,
|
8
|
-
"
|
9
|
-
"
|
8
|
+
"appDefinitionUrl": ui_acd_app_path("__id__"),
|
9
|
+
"foremanDataUrl": ui_acd_foreman_data_path("__id__"),
|
10
|
+
"ansibleVarsAll": [],
|
10
11
|
}
|
11
12
|
else
|
12
13
|
json = {
|
13
14
|
"mode": "editInstance",
|
14
15
|
"organization": current_organization,
|
15
16
|
"location": current_location,
|
16
|
-
"
|
17
|
-
"
|
17
|
+
"appDefinitionUrl": ui_acd_app_path("__id__"),
|
18
|
+
"foremanDataUrl": ui_acd_foreman_data_path("__id__"),
|
18
19
|
"appDefinition": {
|
19
20
|
"id": @app_instance.app_definition.id,
|
20
21
|
"name": @app_instance.app_definition.name,
|
21
22
|
},
|
22
|
-
"hosts":
|
23
|
+
"hosts": collect_hosts_data,
|
24
|
+
"ansibleVarsAll": @app_instance.ansible_vars_all.blank? ? [] : JSON.parse(@app_instance.ansible_vars_all),
|
23
25
|
}
|
24
26
|
end
|
25
27
|
%>
|
@@ -36,11 +38,11 @@
|
|
36
38
|
<%= text_f f, :description %>
|
37
39
|
|
38
40
|
<div id='app_instance'></div>
|
39
|
-
<%=
|
41
|
+
<%= react_component('ApplicationInstance', :data => json) %>
|
40
42
|
</div>
|
41
43
|
</div>
|
42
44
|
</div>
|
43
|
-
|
45
|
+
<%= f.hidden_field :organization_id %>
|
46
|
+
<%= f.hidden_field :location_id %>
|
44
47
|
<%= submit_or_cancel f %>
|
45
48
|
<% end %>
|
46
|
-
|
@@ -1,3 +1,13 @@
|
|
1
|
+
<%=
|
2
|
+
breadcrumbs(:resource_url => "/acd/api/v2/app_instances?location_id=#{@location.id}&organization_id=#{@organization.id}",
|
3
|
+
:items => [
|
4
|
+
{ :caption => _('App Instances'),
|
5
|
+
:url => url_for(app_instances_path) },
|
6
|
+
{ :caption => "Edit #{@app_instance.name}",
|
7
|
+
:url => (edit_app_instance_path(@app_instance) if authorized_for(hash_for_edit_app_instance_path(@app_instance))) }
|
8
|
+
])
|
9
|
+
%>
|
10
|
+
|
1
11
|
<% title(_('Edit Application Instance %s') % @app_instance) %>
|
2
12
|
|
3
13
|
<% content_for(:javascripts) do %>
|
@@ -7,25 +7,104 @@
|
|
7
7
|
<th><%= sort :name, :as => s_('AppInstance|Name') %></th>
|
8
8
|
<th><%= sort :application, :as => _('Application'), :default => 'DESC' %></th>
|
9
9
|
<th><%= _('Description') %></th>
|
10
|
+
<th><%= _('Report') %></th>
|
10
11
|
<th></th>
|
11
12
|
</tr>
|
12
13
|
<% for app_instance in @app_instances %>
|
13
14
|
<tr>
|
14
|
-
<td><%=link_to_if_authorized h(app_instance.name), hash_for_edit_app_instance_path(:id => app_instance)
|
15
|
+
<td><%=link_to_if_authorized h(app_instance.name), hash_for_edit_app_instance_path(:id => app_instance) %></td>
|
15
16
|
<td><%= app_instance.app_definition %></td>
|
16
17
|
<td><%= app_instance.description %></td>
|
18
|
+
<td><%= link_to_if((authorized_for(:auth_object => app_instance, :authorizer => authorizer, :permission => :report_app_instances) &&
|
19
|
+
!app_instance.last_deploy_task.nil? && app_instance.last_deploy_task.ended_at?),
|
20
|
+
_("Show Report"),
|
21
|
+
hash_for_report_app_instance_path(:id => app_instance),
|
22
|
+
:method => :get, :title => _("Show last deployment report for application #{app_instance}")) %></td>
|
17
23
|
<td>
|
18
|
-
<%= action_buttons(
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
24
|
+
<%= action_buttons(
|
25
|
+
display_link_if_authorized(_("Deploy"), { :use_route=>"#",
|
26
|
+
:id => app_instance.id,
|
27
|
+
:action => :deploy,
|
28
|
+
:auth_object => app_instance,
|
29
|
+
:controller => :app_instances },
|
30
|
+
:remote => true, 'data-toggle': "modal", 'data-target': "#deploy#{app_instance.id}",
|
31
|
+
:title => _("Deploy application #{app_instance}")),
|
32
|
+
display_link_if_authorized(_("Run Playbook"),
|
33
|
+
hash_for_remote_execution_path(:id => app_instance.id),
|
34
|
+
:method => :post,
|
35
|
+
:title => _("Run ansible playbook for application #{app_instance}")),
|
36
|
+
display_link_if_authorized(_("Run Playbook - customize first"),
|
37
|
+
hash_for_remote_execution_path(:id => app_instance.id, :customize => true),
|
38
|
+
:method => :post,
|
39
|
+
:title => _("Prepare job to run ansible playbook for application #{app_instance}")),
|
40
|
+
display_link_if_authorized(_("Delete"), { :use_route=>"#",
|
41
|
+
:id => app_instance.id,
|
42
|
+
:action => :destroy,
|
43
|
+
:auth_object => app_instance,
|
44
|
+
:controller => :app_instances },
|
45
|
+
:remote => true, 'data-toggle': "modal", 'data-target': "#delete#{app_instance.id}",
|
46
|
+
:title => _("Delete application #{app_instance}"))
|
47
|
+
) %>
|
48
|
+
</td>
|
25
49
|
</tr>
|
50
|
+
<!-- Delete Modal -->
|
51
|
+
<div class="modal fade" id="delete<%=app_instance.id%>" tabindex="-1" role="dialog" aria-labelledby="deleteLabel" aria-hidden="true">
|
52
|
+
<div class="modal-dialog">
|
53
|
+
<div class="modal-content">
|
54
|
+
<div class="modal-header">
|
55
|
+
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
|
56
|
+
<h4 class="modal-title"><%= _('Confirmation Box')%></h4>
|
57
|
+
</div>
|
58
|
+
<div class="modal-body">
|
59
|
+
<p> <%= _("Confirm to delete ") %> <%= app_instance %></p>
|
60
|
+
<%= form_tag destroy_with_hosts_app_instance_path(:id => app_instance.id), :method => :delete do %>
|
61
|
+
<% if app_instance.foreman_hosts.where.not(:host_id => [nil, false]).any? %>
|
62
|
+
<p><%= _("Select the hosts to delete along with ") %> <%= app_instance %>: </p>
|
63
|
+
<% end %>
|
64
|
+
<% app_instance.foreman_hosts.each do |foreman_host|%>
|
65
|
+
<% if foreman_host.host_id? %>
|
66
|
+
<%= check_box_tag 'foreman_host_ids[]', foreman_host.host_id -%>
|
67
|
+
<%= h foreman_host.host.name -%>
|
68
|
+
</br>
|
69
|
+
<% end %>
|
70
|
+
<% end %>
|
71
|
+
</div>
|
72
|
+
<div class="modal-footer">
|
73
|
+
<button type="button" class="btn btn-primary" data-dismiss="modal"><%= _('Cancel') %></button>
|
74
|
+
<%= submit_tag _("Delete"), name: nil, class: "btn btn-danger" %>
|
75
|
+
<% end %>
|
76
|
+
</div>
|
77
|
+
</div><!-- /.modal-content -->
|
78
|
+
</div><!-- /.modal-dialog -->
|
79
|
+
</div><!-- /.modal -->
|
80
|
+
|
81
|
+
<!-- Deploy Modal -->
|
82
|
+
<div class="modal fade" id="deploy<%=app_instance.id%>" tabindex="-1" role="dialog" aria-labelledby="deployLabel" aria-hidden="true">
|
83
|
+
<div class="modal-dialog">
|
84
|
+
<div class="modal-content">
|
85
|
+
<div class="modal-header">
|
86
|
+
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
|
87
|
+
<h4 class="modal-title"><%= _('Confirmation Box') %></h4>
|
88
|
+
</div>
|
89
|
+
<div class="modal-body">
|
90
|
+
<p><%= _('Confirm to deploy ') %><%= app_instance%></p>
|
91
|
+
<%= form_tag deploy_app_instance_path(:id => app_instance.id), :method => :post do %>
|
92
|
+
<% if app_instance.foreman_hosts.where.not(:host_id => [nil, false]).any? %>
|
93
|
+
<ul>
|
94
|
+
<li><%= check_box_tag 'delete_hosts'-%><%= _('Delete all hosts before deploying ') %><%= app_instance%></li>
|
95
|
+
<li><%= check_box_tag 'safe_deploy' -%><%= _('Deploy only new and changed hosts for ') %><%= app_instance%></li>
|
96
|
+
</ul>
|
97
|
+
<% end %>
|
98
|
+
</div>
|
99
|
+
<div class="modal-footer">
|
100
|
+
<button type="button" class="btn btn-danger" data-dismiss="modal"><%= _('Cancel') %></button>
|
101
|
+
<%= submit_tag _("Submit"), name: nil, class: "btn btn-success" %>
|
102
|
+
<% end %>
|
103
|
+
</div>
|
104
|
+
</div><!-- /.modal-content -->
|
105
|
+
</div><!-- /.modal-dialog -->
|
106
|
+
</div><!-- /.modal -->
|
26
107
|
<% end %>
|
27
108
|
</table>
|
28
|
-
|
29
109
|
<%= page_entries_info @app_instances %>
|
30
110
|
<%= will_paginate @app_instances %>
|
31
|
-
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<% title _("
|
1
|
+
<% title _("Provisioning details for application instance #{@app_instance}") %>
|
2
2
|
|
3
3
|
<% content_for(:javascripts) do %>
|
4
4
|
<%= webpacked_plugins_js_for :foreman_acd %>
|
@@ -10,10 +10,13 @@
|
|
10
10
|
<%
|
11
11
|
json = {
|
12
12
|
"mode": 'lastReport',
|
13
|
-
"
|
13
|
+
"appInstanceName": @app_instance.name,
|
14
|
+
"hosts": @report_hosts,
|
15
|
+
"deployTaskUrl": foreman_tasks_task_path(@app_instance.last_deploy_task),
|
16
|
+
"configureJobUrl": job_invocations_path(search: "description ~ \"ACD application #{@app_instance.name}\"")
|
14
17
|
}
|
15
18
|
%>
|
16
19
|
|
17
20
|
<div id='report'></div>
|
18
|
-
<%=
|
21
|
+
<%= react_component('ApplicationInstanceReport', :data => json) %>
|
19
22
|
</div
|
@@ -0,0 +1,62 @@
|
|
1
|
+
<%#
|
2
|
+
kind: job_template
|
3
|
+
name: Run ACD Ansible Playbook - ACD Default
|
4
|
+
model: JobTemplate
|
5
|
+
job_category: Application Centric Deployment
|
6
|
+
description_format: "Run Ansible playbook to configure ACD application %{application_name}"
|
7
|
+
feature: run_acd_ansible_playbook
|
8
|
+
provider_type: ACD
|
9
|
+
template_inputs:
|
10
|
+
- name: application_name
|
11
|
+
description: The name of the ACD application instance to run
|
12
|
+
input_type: user
|
13
|
+
required: true
|
14
|
+
advanced: false
|
15
|
+
- name: playbook_id
|
16
|
+
description: The id of the Ansible playbook to run
|
17
|
+
input_type: user
|
18
|
+
required: true
|
19
|
+
advanced: false
|
20
|
+
- name: playbook_file
|
21
|
+
description: The playbook file of to the Ansible playbook
|
22
|
+
input_type: user
|
23
|
+
required: true
|
24
|
+
advanced: false
|
25
|
+
- name: inventory
|
26
|
+
description: The Ansible inventory
|
27
|
+
input_type: user
|
28
|
+
required: true
|
29
|
+
advanced: false
|
30
|
+
- name: extra_vars
|
31
|
+
description: Set ansible-playbook extra vars
|
32
|
+
input_type: user
|
33
|
+
required: false
|
34
|
+
advanced: true
|
35
|
+
- name: verbose
|
36
|
+
description: Whether to run the ansible-playbook in verbose mode or not.
|
37
|
+
input_type: user
|
38
|
+
options: "0 - Normal\n1 - Verbose\n2 - More Verbose\n3 - Debug\n4 - Connection Debug"
|
39
|
+
default: "0 - Normal"
|
40
|
+
required: false
|
41
|
+
advanced: true
|
42
|
+
- name: tags
|
43
|
+
description: List of playbook tags to specify which tasks to execute.
|
44
|
+
input_type: user
|
45
|
+
required: false
|
46
|
+
advanced: true
|
47
|
+
- name: skip_tags
|
48
|
+
description: List of playbook tags to skip certain tasks.
|
49
|
+
input_type: user
|
50
|
+
required: false
|
51
|
+
advanced: true
|
52
|
+
%>
|
53
|
+
|
54
|
+
application_name: <%= input('application_name') %>
|
55
|
+
playbook_id: <%= input('playbook_id') %>
|
56
|
+
playbook_file: <%= input('playbook_file') %>
|
57
|
+
extra_vars: <%= input('extra_vars') %>
|
58
|
+
verbose: <%= input('verbose') %>
|
59
|
+
tags: <%= input('tags') %>
|
60
|
+
skip_tags: <%= input('skip_tags') %>
|
61
|
+
inventory: |
|
62
|
+
<%= indent(2) { input('inventory') } %>
|