Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #37942 - Adding Ansible Check Mode to Ansible Job Templates #742

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module JobTemplateExtensions
class_methods do
def job_template_params_filter
super.tap do |filter|
filter.permit :ansible_callback_enabled
filter.permit :ansible_callback_enabled, :ansible_check_mode
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module JobTemplatesControllerExtensions
update_api(:create, :update) do
param :job_template, Hash do
param :ansible_callback_enabled, :bool, :desc => N_('Enable the callback plugin for this template')
param :ansible_check_mode, :bool, :desc => N_('Enable Ansible Check Mode for this template')
end
end
end
Expand Down
1 change: 1 addition & 0 deletions app/models/foreman_ansible/ansible_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def proxy_command_options(template_invocation, host)
),
:name => host.name,
:check_mode => host.host_param('ansible_roles_check_mode'),
:job_check_mode => template_invocation.template.ansible_check_mode,
:cleanup_working_dirs => cleanup_working_dirs?(host)
)
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/api/v2/job_templates/job_templates.json.rabl
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# frozen_string_literal: true

attributes :ansible_callback_enabled
attributes :ansible_callback_enabled, :ansible_check_mode
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<div class="tab-pane" id="ansible_callback_enabled">
<%= checkbox_f f, :ansible_callback_enabled, :label => _('Enable Ansible Callback'), :disabled => @template.locked? %>
<%= checkbox_f f, :ansible_check_mode, :label => _('Enable Ansible Check Mode'), :disabled => @template.locked? %>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddAnsibleCheckModeToTemplates < ActiveRecord::Migration[7.0]
def change
add_column :templates, :ansible_check_mode, :boolean, default: false
end
end
Loading