awx icon indicating copy to clipboard operation
awx copied to clipboard

Change template's instance group

Open Remi-Mergen opened this issue 1 year ago • 2 comments

Please confirm the following

  • [X] I agree to follow this project's code of conduct.
  • [X] I have checked the current issues for duplicates.
  • [X] I understand that AWX is open source software provided for free and that I might not receive a timely response.

Feature type

Enhancement to Existing Feature

Feature Summary

Add a feature to change template's instance group

Select the relevant components

  • [ ] UI
  • [ ] API
  • [ ] Docs
  • [ ] Collection
  • [X] CLI
  • [ ] Other

Steps to reproduce

Hi!

The goal is to change instance groups assigned to templates or inventories

Current results

$> awx job_template modify 18 usage: awx job_templates modify [-h] [--name TEXT] [--description TEXT] [--job_type {run,check}] [--inventory ID] [--project ID] [--playbook TEXT] [--scm_branch TEXT] [--forks INTEGER] [--limit TEXT] [--verbosity {0,1,2,3,4,5}] [--extra_vars JSON/YAML] [--job_tags TEXT] [--force_handlers BOOLEAN] [--skip_tags TEXT] [--start_at_task TEXT] [--timeout INTEGER] [--use_fact_cache BOOLEAN] [--execution_environment ID] [--host_config_key TEXT] [--ask_scm_branch_on_launch BOOLEAN] [--ask_diff_mode_on_launch BOOLEAN] [--ask_variables_on_launch BOOLEAN] [--ask_limit_on_launch BOOLEAN] [--ask_tags_on_launch BOOLEAN] [--ask_skip_tags_on_launch BOOLEAN] [--ask_job_type_on_launch BOOLEAN] [--ask_verbosity_on_launch BOOLEAN] [--ask_inventory_on_launch BOOLEAN] [--ask_credential_on_launch BOOLEAN] [--survey_enabled BOOLEAN] [--become_enabled BOOLEAN] [--diff_mode BOOLEAN] [--allow_simultaneous BOOLEAN] [--job_slice_count INTEGER] [--webhook_service {,github,gitlab}] [--webhook_credential ID] id

positional arguments: id the ID (or unique name) of the resource

optional arguments: -h, --help show this help message and exit --name TEXT Name of this job template. --description TEXT Optional description of this job template. --job_type {run,check} --inventory ID the ID of the associated inventory --project ID the ID of the associated project --playbook TEXT --scm_branch TEXT Branch to use in job run. Project default used if blank. Only allowed if project allow_override field is set to true. --forks INTEGER --limit TEXT --verbosity {0,1,2,3,4,5} --extra_vars JSON/YAML a JSON or YAML string. You can optionally specify a file path e.g., @path/to/file.yml --job_tags TEXT --force_handlers BOOLEAN --skip_tags TEXT --start_at_task TEXT --timeout INTEGER The amount of time (in seconds) to run before the task is canceled. --use_fact_cache BOOLEAN If enabled, the service 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. --execution_environment ID The container image to be used for execution. --host_config_key TEXT --ask_scm_branch_on_launch BOOLEAN --ask_diff_mode_on_launch BOOLEAN --ask_variables_on_launch BOOLEAN --ask_limit_on_launch BOOLEAN --ask_tags_on_launch BOOLEAN --ask_skip_tags_on_launch BOOLEAN --ask_job_type_on_launch BOOLEAN --ask_verbosity_on_launch BOOLEAN --ask_inventory_on_launch BOOLEAN --ask_credential_on_launch BOOLEAN --survey_enabled BOOLEAN --become_enabled BOOLEAN --diff_mode BOOLEAN If enabled, textual changes made to any templated files on the host are shown in the standard output --allow_simultaneous BOOLEAN --job_slice_count INTEGER The number of jobs to slice into at runtime. Will cause the Job Template to launch a workflow if value is greater than 1. --webhook_service {,github,gitlab} Service that webhook requests will be accepted from --webhook_credential ID Personal Access Token for posting back the status to the service API

Sugested feature result

$> awx job_template modify 18 usage: awx job_templates modify [-h] [--name TEXT] [--description TEXT] [--job_type {run,check}] [--inventory ID] [--project ID] [--playbook TEXT] [--scm_branch TEXT] [--forks INTEGER] [--limit TEXT] [--verbosity {0,1,2,3,4,5}] [--extra_vars JSON/YAML] [--job_tags TEXT] [--force_handlers BOOLEAN] [--skip_tags TEXT] [--start_at_task TEXT] [--timeout INTEGER] [--use_fact_cache BOOLEAN] [--execution_environment ID] [--instance_group ID] [--host_config_key TEXT] [--ask_scm_branch_on_launch BOOLEAN] [--ask_diff_mode_on_launch BOOLEAN] [--ask_variables_on_launch BOOLEAN] [--ask_limit_on_launch BOOLEAN] [--ask_tags_on_launch BOOLEAN] [--ask_skip_tags_on_launch BOOLEAN] [--ask_job_type_on_launch BOOLEAN] [--ask_verbosity_on_launch BOOLEAN] [--ask_inventory_on_launch BOOLEAN] [--ask_credential_on_launch BOOLEAN] [--survey_enabled BOOLEAN] [--become_enabled BOOLEAN] [--diff_mode BOOLEAN] [--allow_simultaneous BOOLEAN] [--job_slice_count INTEGER] [--webhook_service {,github,gitlab}] [--webhook_credential ID] id

positional arguments: id the ID (or unique name) of the resource

optional arguments: -h, --help show this help message and exit --name TEXT Name of this job template. --description TEXT Optional description of this job template. --job_type {run,check} --inventory ID the ID of the associated inventory --project ID the ID of the associated project --playbook TEXT --scm_branch TEXT Branch to use in job run. Project default used if blank. Only allowed if project allow_override field is set to true. --forks INTEGER --limit TEXT --verbosity {0,1,2,3,4,5} --extra_vars JSON/YAML a JSON or YAML string. You can optionally specify a file path e.g., @path/to/file.yml --job_tags TEXT --force_handlers BOOLEAN --skip_tags TEXT --start_at_task TEXT --timeout INTEGER The amount of time (in seconds) to run before the task is canceled. --use_fact_cache BOOLEAN If enabled, the service 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. --execution_environment ID The container image to be used for execution. --instance_group ID The instance_group to be used for execution. --host_config_key TEXT --ask_scm_branch_on_launch BOOLEAN --ask_diff_mode_on_launch BOOLEAN --ask_variables_on_launch BOOLEAN --ask_limit_on_launch BOOLEAN --ask_tags_on_launch BOOLEAN --ask_skip_tags_on_launch BOOLEAN --ask_job_type_on_launch BOOLEAN --ask_verbosity_on_launch BOOLEAN --ask_inventory_on_launch BOOLEAN --ask_credential_on_launch BOOLEAN --survey_enabled BOOLEAN --become_enabled BOOLEAN --diff_mode BOOLEAN If enabled, textual changes made to any templated files on the host are shown in the standard output --allow_simultaneous BOOLEAN --job_slice_count INTEGER The number of jobs to slice into at runtime. Will cause the Job Template to launch a workflow if value is greater than 1. --webhook_service {,github,gitlab} Service that webhook requests will be accepted from --webhook_credential ID Personal Access Token for posting back the status to the service API

Additional information

No response

Remi-Mergen avatar Sep 02 '22 08:09 Remi-Mergen

Hello, we'd love to help, but we need a little more information about the feature you are proposing. Currently, you can change instance groups on inventories and job templates.

Are you asking for some prompt on launch functionality or something different?

djyasin avatar Sep 14 '22 16:09 djyasin

Hey!

Yes I'm sorry, that was not very explicit.

I am currently on awx version 18.0.0 and I found no way to change the instance_group assigned to a template. In addition, a Boolean launch prompt function to select your instance_group is a good idea!

In the issue, I have just added a var called "--instance_group ID" and a quick description 🙂

Remi-Mergen avatar Sep 20 '22 09:09 Remi-Mergen

Hi @Remi-Mergen,

The prompt-on-launch functionality for the instance group on a job template was added in the latest release. Try upgrading to the latest version of AWX and let us know if that resolves your issue. We look forward to hearing from you!

akus062381 avatar Oct 28 '22 18:10 akus062381