Cannot choose instance_group id while launching AWX using cli

awx job_templates launch: argument --instance_groups: invalid int value: ‘[3]’
Dear Ansible community,

I am trying to trigger awx cli with --instance_groups argument, I tried with [3] but it is not working
My AWX and Ansible versions are

AWX version : AWX 23.8.1
ansible --version
ansible [core 2.15.13]
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/local/bin/ansible
python version = 3.9.17 (main, Aug 9 2023, 00:00:00) [GCC 11.4.1 20230605 (Red Hat 11.4.1-2)] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True
awx --conf.host [https://awx.us-XXXX.io](https://awx.us-xxxx.io/) --conf.username XXXXX --conf.password XXXX job_templates launch --name XXXXX --extra_vars '{"build_environment”:”XXXX”}’ --inventory XXXX --limit XXXX.com --instance_groups=[3]

Error : awx job_templates launch: argument --instance_groups: invalid int value: '[3]' 

I tried with many other options but nothing works. Please respond and help me with this.

@kurokobo , can you please check if you can help me on this one ?

I haven’t been able to investigate this deeply, but I think it’s likely a bug.

The awxkit treats arguments according to the API specifications, and instance_groups is indicated as a field type:

However, the field type seems to be treated as an int on the awxkit side:

So, actually we need to pass an array to --instance_groups, but int is not an array, so there seems to be no way to handle this.

I recommend invoking the job template with the pure REST API instead of awxkit, or assigning the instance groups to the job template first by REST API, and then invoking it by awxkit.

@djyasin
Hi, I saw that you wrote “I tested” this feature in this issue:

but I (and @SaravanaSelvaraj) couldn’t get it to work.

If it seems like we’re going down the wrong path, please let me know.