Module: ForemanAnsible::Concerns::HostsControllerExtensions

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

Overview

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

Defined Under Namespace

Modules: Overrides

Instance Method Summary collapse

Methods included from JobInvocationHelper

#job_composer

Instance Method Details

#multiple_play_rolesObject



37
38
39
40
41
42
43
44
45
# File 'app/controllers/foreman_ansible/concerns/hosts_controller_extensions.rb', line 37

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

#play_rolesObject



27
28
29
30
31
32
33
34
35
# File 'app/controllers/foreman_ansible/concerns/hosts_controller_extensions.rb', line 27

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