diff --git a/app/controllers/miq_policy_controller/miq_actions.rb b/app/controllers/miq_policy_controller/miq_actions.rb index d8e58d0865a3..5540cec938ea 100644 --- a/app/controllers/miq_policy_controller/miq_actions.rb +++ b/app/controllers/miq_policy_controller/miq_actions.rb @@ -289,6 +289,7 @@ def action_build_edit_screen @edit[:cats] = MiqAction.inheritable_cats.sort_by { |c| c.description.downcase }.collect { |c| [c.name, c.description] } @edit[:ansible_playbooks] = ServiceTemplateAnsiblePlaybook.order(:name).pluck(:name, :id) || {} + @edit[:new][:inventory_type] = 'localhost' action_build_playbook_variables if @action.action_type == "run_ansible_playbook" @edit[:current] = copy_hash(@edit[:new]) @@ -345,7 +346,10 @@ def action_set_record_vars(action) def action_build_playbook_variables @edit[:new][:inventory_type] = 'manual' if @edit[:new][:options][:hosts] @edit[:new][:inventory_type] = 'event_target' if @edit[:new][:options][:use_event_target] - @edit[:new][:inventory_type] ||= 'localhost' + if @edit[:new][:inventory_type].nil? || @edit[:new][:inventory_type].empty? + @edit[:new][:inventory_type] = 'localhost' + @edit[:new][:options][:localhost] = true + end end # Check action record variables