Sha256: 25359891e376bf6b6a4f812f0915daa455f34a2edbf55c583bec704d245b257c
Contents?: true
Size: 1023 Bytes
Versions: 105
Compression:
Stored size: 1023 Bytes
Contents
# frozen_string_literal: true module ForemanAnsible module Concerns # Extra methods to enforce Ansible roles on a host or multiple hosts module HostgroupsControllerExtensions extend ActiveSupport::Concern include ForemanTasks::Triggers include ::ForemanAnsible::Concerns::JobInvocationHelper def play_roles find_resource check_hostgroup composer = job_composer(:ansible_run_host, @hostgroup.hosts) composer.trigger redirect_to job_invocation_path(composer.job_invocation) rescue Foreman::Exception => e error e.message redirect_to hostgroups_path end private def check_hostgroup return unless @hostgroup.hosts.empty? raise ::Foreman::Exception.new( N_('Host group has no associated hosts') ) end def action_permission case params[:action] when 'play_roles' :view else super end end end end end
Version data entries
105 entries across 105 versions & 1 rubygems