Module: ForemanAnsible::Concerns::HostgroupsControllerExtensions

Extended by:
ActiveSupport::Concern
Includes:
JobInvocationHelper, ForemanTasks::Triggers
Defined in:
app/controllers/foreman_ansible/concerns/hostgroups_controller_extensions.rb

Overview

Extra methods to enforce Ansible roles on a host or multiple hosts

Instance Method Summary collapse

Methods included from JobInvocationHelper

#job_composer

Instance Method Details

#play_rolesObject



11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/foreman_ansible/concerns/hostgroups_controller_extensions.rb', line 11

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