Sha256: db2643c1c1e2d2dcf61dd721ffe99dbab3521a0c0985deda8acdef2f805dd064
Contents?: true
Size: 1.34 KB
Versions: 4
Compression:
Stored size: 1.34 KB
Contents
module ForemanAnsible module Api module V2 # Extends the hosts controller to support playing ansible roles module HostsControllerExtensions extend ActiveSupport::Concern include ForemanTasks::Triggers included do api :POST, '/hosts/:id/play_roles', N_('Plays Ansible roles on a host') param :id, String, :required => true def play_roles @result = { :host => @host, :foreman_tasks => async_task( ::Actions::ForemanAnsible::PlayHostRoles, @host ) } render_message @result end api :POST, '/hosts/play_roles', N_('Plays Ansible roles on hosts') param :id, Array, :required => true def multiple_play_roles @result = [] @host.each do |item| @result.append( :host => item, :foreman_tasks => async_task( ::Actions::ForemanAnsible::PlayHostRoles, item ) ) end render_message @result end end private def action_permission case params[:action] when 'play_roles', 'multiple_play_roles' :view else super end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems