0

I have well over a dozen jobs within AWX, but given the following code only returns one job name:

- name: Set job_name(s) as facts for limiting job rename
  set_fact:
    job: "{{ job_name|default([]) + [ {
      'name': item['name']
      } ] }}"
  loop: "{{ query('awx.awx.controller_api', 'job_templates', host=awx_host,
                     username=awx_user, password=awx_pass, verify_ssl=False) }}"
  loop_control:
    label: "{{ item['name'] }}"

- debug:
    msg: '{{ item.name }}'
  with_items: '{{ job }}'

Actual results (but expect to see all job names):

TASK [cfg_actions : debug] *****************************************************
   ok: [localhost] => (item={'name': 'Job name 1'}) => {
   "msg": "Job name 1"
   }

It seems this should be fairly simple but I cannot seem to figure out what is missing. Is there a general practice for combining lists without using 'join', as 'join' often splits all letters of a variable with commas (rather than joining the variables).

Thanks in advance for any help.

BrillCom
  • 139
  • 2
  • 9

0 Answers0