Class: AnsibleTowerClient::JobTemplateV2

Inherits:
JobTemplate show all
Defined in:
lib/ansible_tower_client/v2/job_template_v2.rb

Instance Attribute Summary

Attributes inherited from BaseModel

#api, #raw_hash

Instance Method Summary collapse

Methods inherited from JobTemplate

#extra_vars_hash, #override_raw_attributes, #survey_spec, #survey_spec_hash

Methods inherited from BaseModel

base_class, create, create!, #destroy, #destroy!, endpoint, #hashify, #initialize, #override_raw_attributes, #save, #save!, #update_attributes, #update_attributes!

Methods inherited from HashModel

#==, #[], #initialize, #inspect, #to_h, #to_json

Constructor Details

This class inherits a constructor from AnsibleTowerClient::BaseModel

Instance Method Details

#launch(options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/ansible_tower_client/v2/job_template_v2.rb', line 3

def launch(options = {})
  launch_url = "#{url}launch/"
  options = options.dup
  new_limit = options.delete(:limit) || options.delete('limit')
  response = with_temporary_changes(new_limit) do
    api.post(launch_url, options).body
  end

  job = JSON.parse(response)
  api.jobs.find(job['job'])
end