Sha256: 3ad83cc6e99c14ac506855a46b66d31d476e73491589fbb5ec11b6e62fe33e06
Contents?: true
Size: 1.04 KB
Versions: 4
Compression:
Stored size: 1.04 KB
Contents
module ForemanAnsible module Concerns # Extra methods to enforce Ansible roles on a host or multiple hosts module HostsControllerExtensions extend ActiveSupport::Concern include ForemanTasks::Triggers included do alias_method_chain :action_permission, :ansible end def play_roles find_resource task = async_task(::Actions::ForemanAnsible::PlayHostRoles, @host) redirect_to task rescue Foreman::Exception => e error e.message redirect_to host_path(@host) end def multiple_play_roles find_multiple task = async_task(::Actions::ForemanAnsible::PlayHostsRoles, @hosts) redirect_to task rescue Foreman::Exception => e error e.message redirect_to hosts_path end private def action_permission_with_ansible case params[:action] when 'multiple_play_roles', 'play_roles' :view else action_permission_without_ansible end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems