Job Template¶
Description¶
This resource is used for managing job template resources in Tower. It is also responsible to associate/disassociate
labels and notification templates to/from an existing job template. There is yet another custom command, survey
,
used for getting survey specification of a job template.
Fields Table¶
name | type | help_text | read_only | unique | filterable | required |
---|---|---|---|---|---|---|
name | String | The name field. | False | True | True | True |
description | String | The description field. | False | False | True | False |
job_type | Choices: run,check | The job_type field. | False | False | True | False |
inventory | Resource inventory | The inventory field. | False | False | True | False |
project | Resource project | The project field. | False | False | True | True |
playbook | String | The playbook field. | False | False | True | True |
credential | Resource credential | The credential field. | False | False | True | False |
vault_credential | Resource credential | The vault_credential field. | False | False | True | False |
forks | int | The forks field. | False | False | True | False |
limit | String | The limit field. | False | False | True | False |
verbosity | mapped_choice | The verbosity field. | False | False | True | False |
extra_vars | variables | Extra variables used by Ansible in YAML or key=value format. Use @ to get YAML from a file. | False | False | True | False |
job_tags | String | The job_tags field. | False | False | True | False |
force_handlers | bool | The force_handlers field. | False | False | True | False |
skip_tags | String | The skip_tags field. | False | False | True | False |
start_at_task | String | The start_at_task field. | False | False | True | False |
timeout | int | The amount of time (in seconds) to run before the task is canceled. | False | False | True | False |
use_fact_cache | bool | If enabled, Tower will act as an Ansible Fact Cache Plugin; persisting facts at the end of a playbook run to the database and caching facts for use by Ansible. | False | False | True | False |
host_config_key | String | Allow Provisioning Callbacks using this host config key | False | False | True | False |
ask_diff_mode_on_launch | bool | Ask diff mode on launch. | False | False | True | False |
ask_variables_on_launch | bool | Prompt user for extra_vars on launch. | False | False | True | False |
ask_limit_on_launch | bool | Prompt user for host limits on launch. | False | False | True | False |
ask_tags_on_launch | bool | Prompt user for job tags on launch. | False | False | True | False |
ask_skip_tags_on_launch | bool | Prompt user for tags to skip on launch. | False | False | True | False |
ask_job_type_on_launch | bool | Prompt user for job type on launch. | False | False | True | False |
ask_verbosity_on_launch | bool | Prompt user for verbosity on launch. | False | False | True | False |
ask_inventory_on_launch | bool | Prompt user for inventory on launch. | False | False | True | False |
ask_credential_on_launch | bool | Prompt user for machine credential on launch. | False | False | True | False |
survey_enabled | bool | Prompt user for job type on launch. | False | False | True | False |
become_enabled | bool | The become_enabled field. | False | False | True | False |
diff_mode | bool | If enabled, textual changes made to any templated files on the host are shown in the standard output. | False | False | True | False |
allow_simultaneous | bool | The allow_simultaneous field. | False | False | True | False |
survey_spec | variables | On write commands, perform extra POST to the survey_spec endpoint. | False | False | True | False |
API Specification¶
-
class
tower_cli.resources.job_template.
Resource
[source]¶ A resource for job templates.
-
associate_credential
(job_template, credential)[source]¶ Associate a credential with this job template.
Parameters: Returns: Dictionary of only one key “changed”, which indicates whether the association succeeded.
Return type:
-
associate_ig
(**kwargs)¶ Associate an ig with this job_template.
Parameters: Returns: Dictionary of only one key “changed”, which indicates whether the associate succeeded.
Return type:
-
associate_label
(**kwargs)¶ Associate a label with this job_template.
Parameters: Returns: Dictionary of only one key “changed”, which indicates whether the associate succeeded.
Return type:
-
associate_notification_template
(job_template, notification_template, status)[source]¶ Associate a notification template from this job template.
Parameters: Returns: Dictionary of only one key “changed”, which indicates whether the association succeeded.
Return type:
-
callback
(pk=None, host_config_key=u'', extra_vars=None)[source]¶ Contact Tower and request a provisioning callback using this job template.
Parameters: Returns: A dictionary of a single key “changed”, which indicates whether the provisioning callback is successful.
Return type:
-
copy
(pk=None, new_name=None, **kwargs)[source]¶ Copy an object.
Parameters: - pk (int) – Primary key of the resource object to be copied
- new_name – The new name to give the resource if deep copying via the API
- **kwargs – Keyword arguments of fields whose given value will override the original value.
Returns: loaded JSON of the copied new resource object.
Return type:
-
create
(**kwargs)[source]¶ Create an object.
Parameters: - fail_on_found (bool) – Flag that if set, the operation fails if an object matching the unique criteria already exists.
- force_on_exists (bool) – Flag that if set, then if a match is found on unique fields, other fields will be updated to the provided values.; If unset, a match causes the request to be a no-op.
- **kwargs – Keyword arguments which, all together, will be used as POST body to create the resource object.
Returns: A dictionary combining the JSON output of the created resource, as well as two extra fields: “changed”, a flag indicating if the resource is created successfully; “id”, an integer which is the primary key of the created object.
Return type:
-
delete
(pk=None, fail_on_missing=False, **kwargs)¶ Remove the given object.
Parameters: Returns: dictionary of only one field “changed”, which is a flag indicating whether the specified resource is successfully deleted.
Return type:
-
disassociate_credential
(job_template, credential)[source]¶ Disassociate a credential from this job template.
Parameters: Returns: Dictionary of only one key “changed”, which indicates whether the disassociation succeeded.
Return type:
-
disassociate_ig
(**kwargs)¶ Disassociate an ig with this job_template.
Parameters: Returns: Dictionary of only one key “changed”, which indicates whether the disassociate succeeded.
Return type:
-
disassociate_label
(**kwargs)¶ Disassociate a label with this job_template.
Parameters: Returns: Dictionary of only one key “changed”, which indicates whether the disassociate succeeded.
Return type:
-
disassociate_notification_template
(job_template, notification_template, status)[source]¶ Disassociate a notification template from this job template.
Parameters: Returns: Dictionary of only one key “changed”, which indicates whether the disassociation succeeded.
Return type:
-
get
(pk=None, **kwargs)¶ Retrieve one and exactly one object.
Parameters: - pk (int) – Primary key of the resource to be read. Tower CLI will only attempt to read that object
if
pk
is provided (notNone
). - **kwargs – Keyword arguments used to look up resource object to retrieve if
pk
is not provided.
Returns: loaded JSON of the retrieved resource object.
Return type: - pk (int) – Primary key of the resource to be read. Tower CLI will only attempt to read that object
if
-
list
(all_pages=False, **kwargs)¶ Retrieve a list of objects.
Parameters: - all_pages (bool) – Flag that if set, collect all pages of content from the API when returning results.
- page (int) – The page to show. Ignored if all_pages is set.
- query (list) – Contains 2-tuples used as query parameters to filter resulting resource objects.
- **kwargs – Keyword arguments list of available fields used for searching resource objects.
Returns: A JSON object containing details of all resource objects returned by Tower backend.
Return type:
-
modify
(pk=None, create_on_missing=False, **kwargs)[source]¶ Modify an already existing object.
Parameters: - pk (int) – Primary key of the resource to be modified.
- create_on_missing (bool) – Flag that if set, a new object is created if
pk
is not set and objects matching the appropriate unique criteria is not found. - **kwargs – Keyword arguments which, all together, will be used as PATCH body to modify the
resource object. if
pk
is not set, key-value pairs of**kwargs
which are also in resource’s identity will be used to lookup existing reosource.
Returns: A dictionary combining the JSON output of the modified resource, as well as two extra fields: “changed”, a flag indicating if the resource is successfully updated; “id”, an integer which is the primary key of the updated object.
Return type:
-
survey
(pk=None, **kwargs)¶ Get the survey specification of a resource object.
Parameters: - pk (int) – Primary key of the resource to retrieve survey from. Tower CLI will only attempt to
read that object if
pk
is provided (notNone
). - **kwargs – Keyword arguments used to look up resource object to retrieve survey if
pk
is not provided.
Returns: loaded JSON of the retrieved survey specification of the resource object.
Return type: - pk (int) – Primary key of the resource to retrieve survey from. Tower CLI will only attempt to
read that object if
-