Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a method to queue an Ansible::Runner.run #17705

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions lib/ansible/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ def run(env_vars, extra_vars, playbook_path)
run_via_cli(env_vars, extra_vars, playbook_path)
end

def run_queue(env_vars, extra_vars, playbook_path, user_id, queue_opts)
queue_opts = {
:args => [env_vars, extra_vars, playbook_path],
:queue_name => "generic",
:class_name => name,
:method_name => "run",
}.merge(queue_opts)

task_opts = {
:action => "Run Ansible Playbook",
:userid => user_id,
}

MiqTask.generic_action_with_callback(task_opts, queue_opts)
end

private

def run_via_cli(env_vars, extra_vars, playbook_path)
Expand Down