Sha256: 182a4848292d78bcb7375e0fa4b23fe87fcfa0799bd4f8c53dde686c384549b2
Contents?: true
Size: 1.22 KB
Versions: 104
Compression:
Stored size: 1.22 KB
Contents
# frozen_string_literal: true module ForemanAnsible module Concerns # Extra methods to enforce Ansible roles on a host or multiple hosts module HostsControllerExtensions extend ActiveSupport::Concern include ForemanTasks::Triggers include JobInvocationHelper # Overrides to methods in the original hosts controller module Overrides def action_permission case params[:action] when 'multiple_play_roles', 'play_roles' :view else super end end end included do prepend Overrides end def play_roles find_resource composer = job_composer(:ansible_run_host, @host) composer.trigger redirect_to job_invocation_path(composer.job_invocation) rescue Foreman::Exception => e error e.message redirect_to host_path(@host) end def multiple_play_roles find_multiple composer = job_composer(:ansible_run_host, @hosts) composer.trigger redirect_to job_invocation_path(composer.job_invocation) rescue Foreman::Exception => e error e.message redirect_to hosts_path end end end end
Version data entries
104 entries across 104 versions & 1 rubygems