foreman_acd 0.2.1 → 0.3.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_acd/ansible_playbooks_controller.rb +122 -0
- data/app/controllers/foreman_acd/api/v2/ansible_playbooks_controller.rb +54 -0
- data/app/controllers/foreman_acd/api/v2/app_instances_controller.rb +54 -0
- data/app/controllers/foreman_acd/api/v2/app_playbooks_controller.rb +0 -0
- data/app/controllers/foreman_acd/app_definitions_controller.rb +7 -4
- data/app/controllers/foreman_acd/app_instances_controller.rb +33 -126
- 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/ui_acd_controller.rb +11 -3
- data/app/models/foreman_acd/ansible_playbook.rb +50 -0
- data/app/models/foreman_acd/app_definition.rb +2 -0
- data/app/models/foreman_acd/app_instance.rb +7 -0
- data/app/services/foreman_acd/app_configurator.rb +70 -0
- data/app/services/foreman_acd/app_deployer.rb +143 -0
- data/app/services/foreman_acd/inventory_creator.rb +67 -0
- data/app/views/foreman_acd/ansible_playbooks/_form.html.erb +21 -0
- data/app/views/foreman_acd/ansible_playbooks/edit.html.erb +3 -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 +3 -0
- data/app/views/foreman_acd/api/v2/ansible_playbooks/index.json.rabl +3 -0
- data/app/views/foreman_acd/api/v2/ansible_playbooks/show.json.rabl +3 -0
- data/app/views/foreman_acd/api/v2/app_definitions/base.json.rabl +3 -0
- data/app/views/foreman_acd/api/v2/app_definitions/index.json.rabl +3 -0
- data/app/views/foreman_acd/api/v2/app_definitions/show.json.rabl +3 -0
- data/app/views/foreman_acd/api/v2/app_instances/base.json.rabl +3 -0
- data/app/views/foreman_acd/api/v2/app_instances/index.json.rabl +3 -0
- data/app/views/foreman_acd/api/v2/app_instances/show.json.rabl +3 -0
- data/app/views/foreman_acd/app_definitions/_form.html.erb +24 -10
- data/app/views/foreman_acd/app_definitions/edit.html.erb +5 -0
- data/app/views/foreman_acd/app_instances/_form.html.erb +7 -5
- data/app/views/foreman_acd/app_instances/index.html.erb +5 -1
- data/app/views/templates/job/run_acd_ansible_playbook.erb +49 -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 +24 -1
- 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 +5 -0
- data/db/migrate/20201016104338_add_ansible_vars_all_to_app_instances.rb +5 -0
- data/db/seeds.d/75-job_templates.rb +8 -0
- data/lib/foreman_acd/engine.rb +3 -0
- data/lib/foreman_acd/plugin.rb +53 -2
- data/lib/foreman_acd/version.rb +1 -1
- data/package.json +1 -1
- data/webpack/components/ApplicationDefinition/ApplicationDefinition.js +137 -22
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionActions.js +95 -11
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionConstants.js +7 -2
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionHelper.js +26 -0
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionReducer.js +117 -21
- data/webpack/components/ApplicationDefinition/ApplicationDefinitionSelectors.js +2 -0
- data/webpack/components/ApplicationDefinition/components/AnsiblePlaybookSelector.js +49 -0
- data/webpack/components/ApplicationDefinition/index.js +4 -0
- data/webpack/components/ApplicationInstance/ApplicationInstance.js +92 -22
- data/webpack/components/ApplicationInstance/ApplicationInstanceActions.js +37 -8
- data/webpack/components/ApplicationInstance/ApplicationInstanceConstants.js +4 -2
- data/webpack/components/ApplicationInstance/ApplicationInstanceReducer.js +98 -26
- data/webpack/components/ApplicationInstance/ApplicationInstanceSelectors.js +2 -1
- data/webpack/components/ApplicationInstance/index.js +2 -0
- data/webpack/components/ParameterSelection/ParameterSelection.js +46 -37
- data/webpack/components/ParameterSelection/ParameterSelectionActions.js +49 -52
- data/webpack/components/ParameterSelection/ParameterSelectionConstants.js +5 -3
- data/webpack/components/ParameterSelection/ParameterSelectionHelper.js +0 -32
- data/webpack/components/ParameterSelection/ParameterSelectionReducer.js +32 -16
- data/webpack/components/ParameterSelection/ParameterSelectionSelectors.js +2 -2
- data/webpack/components/ParameterSelection/index.js +4 -4
- data/webpack/components/common/DeleteTableEntry.js +1 -1
- data/webpack/reducer.js +14 -11
- metadata +48 -3
@@ -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).merge(:auth_object => ansible_playbook, :authorizer => authorizer) %></td>
|
16
|
+
<td><%= ansible_playbook.description %></td>
|
17
|
+
<td>
|
18
|
+
<%= action_buttons(
|
19
|
+
display_delete_if_authorized(hash_for_ansible_playbook_path(:id => ansible_playbook).merge(:auth_object => ansible_playbook, :authorizer => authorizer),
|
20
|
+
:data => { 'confirm': _('Delete %s?') % ansible_playbook.name }),
|
21
|
+
display_link_if_authorized(_("Import group variables"), hash_for_import_vars_ansible_playbook_path(:id => ansible_playbook).merge(:auth_object => ansible_playbook, :authorizer => authorizer))
|
22
|
+
) %>
|
23
|
+
</td>
|
24
|
+
</tr>
|
25
|
+
<% end %>
|
26
|
+
</table>
|
27
|
+
|
28
|
+
<%= page_entries_info @ansible_playbooks %>
|
29
|
+
<%= will_paginate @ansible_playbooks %>
|
30
|
+
|
@@ -1,15 +1,29 @@
|
|
1
1
|
<%
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
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
|
+
}
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
-
|
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| %>
|
@@ -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
23
|
"hosts": JSON.parse(@app_instance.hosts),
|
24
|
+
"ansibleVarsAll": @app_instance.ansible_vars_all.blank? ? [] : JSON.parse(@app_instance.ansible_vars_all),
|
23
25
|
}
|
24
26
|
end
|
25
27
|
%>
|
@@ -17,10 +17,14 @@
|
|
17
17
|
<td>
|
18
18
|
<%= action_buttons(display_link_if_authorized(_("Deploy"), hash_for_deploy_app_instance_path(:id => app_instance), :method => :post,
|
19
19
|
:title => _("Deploy application #{app_instance}")),
|
20
|
+
display_link_if_authorized(_("Run Playbook"), hash_for_configure_app_instance_path(:id => app_instance), :method => :post,
|
21
|
+
:title => _("Run ansible playbook for application #{app_instance}")),
|
22
|
+
display_link_if_authorized(_("Run Playbook - customize first"), hash_for_configure_app_instance_path(:id => app_instance, :customize => true), :method => :post,
|
23
|
+
:title => _("Prepare job to run ansible playbook for application #{app_instance}")),
|
20
24
|
display_link_if_authorized(_("Report"), hash_for_report_app_instance_path(:id => app_instance), :method => :get,
|
21
25
|
:title => _("Show last deployment report for application #{app_instance}")),
|
22
26
|
display_delete_if_authorized(hash_for_app_instance_path(:id => app_instance).merge(:auth_object => app_instance, :authorizer => authorizer),
|
23
|
-
|
27
|
+
:data => { 'confirm': _('Delete %s?') % app_instance.name })) %>
|
24
28
|
</td>
|
25
29
|
</tr>
|
26
30
|
<% end %>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<%#
|
2
|
+
kind: job_template
|
3
|
+
name: Run ACD Ansible Playbook - SSH Default
|
4
|
+
model: JobTemplate
|
5
|
+
job_category: Application Centric Deployment
|
6
|
+
description_format: "Run Ansible playbook %{playbook_name} for ACD application %{application_name}"
|
7
|
+
provider_type: SSH
|
8
|
+
feature: run_acd_ansible_playbook
|
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_name
|
16
|
+
description: The name of the Ansible playbook to run
|
17
|
+
input_type: user
|
18
|
+
required: true
|
19
|
+
advanced: false
|
20
|
+
- name: playbook_path
|
21
|
+
description: The full path 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: "false\ntrue"
|
39
|
+
required: false
|
40
|
+
advanced: true
|
41
|
+
%>
|
42
|
+
|
43
|
+
INVENTORY_FILE=$(mktemp --suffix ".yaml")
|
44
|
+
cat << EOF >$INVENTORY_FILE
|
45
|
+
<%= input('inventory') %>
|
46
|
+
EOF
|
47
|
+
|
48
|
+
echo "Run ansible-playbook <%= input('playbook_name') %> to configure ACD app <%= input('application_name') %>"
|
49
|
+
ansible-playbook -i $INVENTORY_FILE <%= "-v" if input('verbose').present? && input('verbose') == 'true' %> <%= "--extra-vars \"#{input('extra_vars')}\"" unless input('extra_vars').blank? %> <%= input('playbook_path') %>
|
@@ -4,6 +4,10 @@ child @app_data['app_definition'] => :app_definition do
|
|
4
4
|
extends 'ui_acd/app_definition'
|
5
5
|
end
|
6
6
|
|
7
|
-
child @app_data['
|
8
|
-
extends 'ui_acd/
|
7
|
+
child @app_data['foreman_data'] => :foreman_data do
|
8
|
+
extends 'ui_acd/foreman_data'
|
9
|
+
end
|
10
|
+
|
11
|
+
child @app_data['ansible_data'] => :ansible_data do
|
12
|
+
extends 'ui_acd/ansible_data'
|
9
13
|
end
|
data/config/routes.rb
CHANGED
@@ -2,6 +2,16 @@
|
|
2
2
|
|
3
3
|
Rails.application.routes.draw do
|
4
4
|
scope :acd, :path => '/acd' do
|
5
|
+
resources :ansible_playbooks, :controller => 'foreman_acd/ansible_playbooks' do
|
6
|
+
collection do
|
7
|
+
get 'auto_complete_search'
|
8
|
+
end
|
9
|
+
|
10
|
+
member do
|
11
|
+
get 'import_vars'
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
5
15
|
resources :app_definitions, :controller => 'foreman_acd/app_definitions' do
|
6
16
|
collection do
|
7
17
|
get 'auto_complete_search'
|
@@ -21,11 +31,24 @@ Rails.application.routes.draw do
|
|
21
31
|
|
22
32
|
member do
|
23
33
|
post 'deploy'
|
34
|
+
post 'configure'
|
24
35
|
get 'report'
|
25
36
|
end
|
26
37
|
end
|
27
38
|
|
28
39
|
get 'ui_acd_app/:id', :to => 'ui_acd#app', :constraints => { :id => /[\w\.-]+/ }, :as => :ui_acd_app
|
29
|
-
get '
|
40
|
+
get 'ui_acd_foreman_data/:id', :to => 'ui_acd#foreman_data', :constraints => { :id => /[\w\.-]+/ }, :as => :ui_acd_foreman_data
|
41
|
+
get 'ui_acd_ansible_data/:id', :to => 'ui_acd#ansible_data', :constraints => { :id => /[\w\.-]+/ }, :as => :ui_acd_ansible_data
|
42
|
+
|
43
|
+
scope :api, :path => '/api', :defaults => { :format => 'json' } do
|
44
|
+
scope '(:apiv)', :defaults => { :apiv => 'v2' },
|
45
|
+
:apiv => /v1|v2/, :constraints => ApiConstraints.new(:version => 2) do
|
46
|
+
constraints(:id => /[\w\.-]+/) do
|
47
|
+
resources :app_definitions, :only => [:show, :index], :controller => 'foreman_acd/api/v2/app_definitions', :as => :acd_api_v2_app_definitions
|
48
|
+
resources :app_instances, :only => [:show, :index], :controller => 'foreman_acd/api/v2/app_instances', :as => :api_v2_foreman_acd_app_instances
|
49
|
+
resources :ansible_playbooks, :only => [:show, :index], :controller => 'foreman_acd/api/v2/ansible_playbooks', :as => :api_v2_foreman_acd_ansible_playbooks
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
30
53
|
end
|
31
54
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Adding acd ansible playbooks db table
|
4
|
+
class CreateAnsiblePlaybooks < ActiveRecord::Migration[5.2]
|
5
|
+
def up
|
6
|
+
create_table :acd_ansible_playbooks do |t|
|
7
|
+
t.string :name, :default => '', :null => false, :limit => 255, :unique => true
|
8
|
+
t.text :description
|
9
|
+
t.string :scm_type
|
10
|
+
t.string :path
|
11
|
+
t.string :playfile
|
12
|
+
t.text :vars
|
13
|
+
t.timestamps :null => true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def down
|
18
|
+
drop_table :acd_ansible_playbooks
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Adding acd ansible playbooks db table
|
4
|
+
class AddAnsiblePlaybookId < ActiveRecord::Migration[5.2]
|
5
|
+
def up
|
6
|
+
add_column :app_definitions, :acd_ansible_playbook_id, :integer
|
7
|
+
add_foreign_key "app_definitions", "acd_ansible_playbooks", :name => "app_definitions_acd_ansible_playbooks_id_fk"
|
8
|
+
end
|
9
|
+
|
10
|
+
def down
|
11
|
+
remove_foreign_key 'app_definitions', :name => 'app_definitions_acd_ansible_playbooks_id_fk'
|
12
|
+
remove_column :app_definitions, :acd_ansible_playbook_id
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
User.as_anonymous_admin do
|
2
|
+
JobTemplate.without_auditing do
|
3
|
+
Dir[File.join("#{ForemanAcd::Engine.root}/app/views/templates/**/*.erb")].each do |template|
|
4
|
+
sync = !Rails.env.test? && Setting[:remote_execution_sync_templates]
|
5
|
+
JobTemplate.import_raw!(File.read(template), :default => true, :locked => true, :update => sync)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
end
|
data/lib/foreman_acd/engine.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'foreman_remote_execution'
|
4
|
+
|
3
5
|
module ForemanAcd
|
4
6
|
# This engine connects ForemanAcd with Foreman core
|
5
7
|
class Engine < ::Rails::Engine
|
@@ -12,6 +14,7 @@ module ForemanAcd
|
|
12
14
|
config.autoload_paths += Dir["#{config.root}/app/overrides"]
|
13
15
|
config.autoload_paths += Dir["#{config.root}/app/services"]
|
14
16
|
config.autoload_paths += Dir["#{config.root}/app/lib"]
|
17
|
+
config.autoload_paths += Dir["#{config.root}/lib"]
|
15
18
|
|
16
19
|
# Add any db migrations
|
17
20
|
initializer 'foreman_acd.load_app_instance_data' do |app|
|
data/lib/foreman_acd/plugin.rb
CHANGED
@@ -1,12 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
Foreman::Plugin.register :foreman_acd do
|
4
|
-
requires_foreman '>= 1
|
4
|
+
requires_foreman '>= 2.1'
|
5
5
|
|
6
6
|
apipie_documented_controllers ["#{ForemanAcd::Engine.root}/app/controllers/foreman_acd/api/v2/*.rb"]
|
7
7
|
|
8
8
|
# Menus
|
9
9
|
divider :top_menu, :parent => :configure_menu, :caption => 'Applications'
|
10
|
+
menu :top_menu, :ansible_playbooks,
|
11
|
+
:url_hash => { :controller => :'foreman_acd/ansible_playbooks', :action => :index },
|
12
|
+
:caption => 'Ansible Playbooks',
|
13
|
+
:parent => :configure_menu
|
14
|
+
|
10
15
|
menu :top_menu, :app_definitions,
|
11
16
|
:url_hash => { :controller => :'foreman_acd/app_definitions', :action => :index },
|
12
17
|
:caption => 'App Definitions',
|
@@ -19,6 +24,31 @@ Foreman::Plugin.register :foreman_acd do
|
|
19
24
|
|
20
25
|
# Add permissions
|
21
26
|
security_block :foreman_acd do
|
27
|
+
permission :create_ansible_playbooks,
|
28
|
+
{ :'foreman_acd/ansible_playbooks' => [:new, :create],
|
29
|
+
:'foreman_acd/api/v2/ansible_playbooks' => [:create] },
|
30
|
+
:resource_type => 'ForemanAcd::AnsiblePlaybook'
|
31
|
+
|
32
|
+
permission :view_ansible_playbooks,
|
33
|
+
{ :'foreman_acd/ansible_playbooks' => [:index, :show, :auto_complete_search],
|
34
|
+
:'foreman_acd/api/v2/ansible_playbooks' => [:index, :show] },
|
35
|
+
:resource_type => 'ForemanAcd::AnsiblePlaybook'
|
36
|
+
|
37
|
+
permission :edit_ansible_playbooks,
|
38
|
+
{ :'foreman_acd/ansible_playbooks' => [:update, :edit],
|
39
|
+
:'foreman_acd/api/v2/ansible_playbooks' => [:update] },
|
40
|
+
:resource_type => 'ForemanAcd::AnsiblePlaybook'
|
41
|
+
|
42
|
+
permission :destroy_ansible_playbooks,
|
43
|
+
{ :'foreman_acd/ansible_playbooks' => [:destroy],
|
44
|
+
:'foreman_acd/api/v2/ansible_playbooks' => [:destroy] },
|
45
|
+
:resource_type => 'ForemanAcd::AnsiblePlaybook'
|
46
|
+
|
47
|
+
permission :import_vars_ansible_playbooks,
|
48
|
+
{ :'foreman_acd/ansible_playbooks' => [:import_vars],
|
49
|
+
:'foreman_acd/api/v2/ansible_playbooks' => [:import_vars] },
|
50
|
+
:resource_type => 'ForemanAcd::AnsiblePlaybook'
|
51
|
+
|
22
52
|
permission :create_app_definitions,
|
23
53
|
{ :'foreman_acd/app_definitions' => [:new, :create],
|
24
54
|
:'foreman_acd/api/v2/app_definitions' => [:create] },
|
@@ -74,6 +104,11 @@ Foreman::Plugin.register :foreman_acd do
|
|
74
104
|
:'foreman_acd/api/v2/app_instances' => [:deploy] },
|
75
105
|
:resource_type => 'ForemanAcd::AppInstance'
|
76
106
|
|
107
|
+
permission :configure_app_instances,
|
108
|
+
{ :'foreman_acd/app_instances' => [:configure],
|
109
|
+
:'foreman_acd/api/v2/app_instances' => [:configure] },
|
110
|
+
:resource_type => 'ForemanAcd::AppInstance'
|
111
|
+
|
77
112
|
permission :report_app_instances,
|
78
113
|
{ :'foreman_acd/app_instances' => [:report],
|
79
114
|
:'foreman_acd/api/v2/app_instances' => [:report] },
|
@@ -81,9 +116,15 @@ Foreman::Plugin.register :foreman_acd do
|
|
81
116
|
end
|
82
117
|
|
83
118
|
# Manager Role
|
84
|
-
role 'Application Centric Deployment Manager', [:
|
119
|
+
role 'Application Centric Deployment Manager', [:create_ansible_playbooks,
|
120
|
+
:view_ansible_playbooks,
|
121
|
+
:edit_ansible_playbooks,
|
122
|
+
:destroy_ansible_playbooks,
|
123
|
+
:import_vars_ansible_playbooks,
|
124
|
+
:create_app_definitions,
|
85
125
|
:view_app_definitions,
|
86
126
|
:edit_app_definitions,
|
127
|
+
:destroy_app_definitions,
|
87
128
|
:export_app_definitions,
|
88
129
|
:import_app_definitions]
|
89
130
|
|
@@ -93,5 +134,15 @@ Foreman::Plugin.register :foreman_acd do
|
|
93
134
|
:edit_app_instances,
|
94
135
|
:destroy_app_instances,
|
95
136
|
:deploy_app_instances,
|
137
|
+
:configure_app_instances,
|
96
138
|
:report_app_instances]
|
139
|
+
|
140
|
+
RemoteExecutionFeature.register(
|
141
|
+
:run_acd_ansible_playbook,
|
142
|
+
N_('Run playbook for ACD'),
|
143
|
+
{
|
144
|
+
:description => N_('Run an Ansible playbook to configure ACD application'),
|
145
|
+
:provided_inputs => %w[application_name playbook_name playbook_path inventory_path]
|
146
|
+
}
|
147
|
+
)
|
97
148
|
end
|