Try to put 1 Ansible facts from multiple servers into one list

I feel this should be easy.

I’m trying to put a fact I set on each server into one central list.
sat_id is the Big List
sat_id_raw is the variable that I set earlier in the automation.

What am I missing here?

Thanks in advance

name: Put all of the var into a big list

set_fact:

sat_id: “{{ sat_id }} + [‘{{ sat_id_raw }}’]”

delegate_to: localhost

  • name: Print object type

debug:

var: sat_id

delegate_to: localhost

TASK [Facts-list : Put all of the vars into a big list] *****************************************************************************************************************************

ok: [MY-SERVER1 → localhost] => {

“ansible_facts”: {

“sat_id”: [

“15929”

]

},

“changed”: false

}

ok: [MY-SERVER2 → localhost] => {

“ansible_facts”: {

“sat_id”: [

“13409”

]

},

“changed”: false

}

TASK [Facts-list : Print object type] ***********************************************************************************************************************

task path: /data/grskelt/satellite-devel/satellite-contentviews-list/tasks/main.yml:96

ok: [MY-SERVER1 → localhost] => {

“sat_id”: [

“15929”

]

}

ok: [MY-SERVER2 → localhost] => {

“sat_id”: [

“13409”

]

I feel this should be easy.

I'm trying to put a fact I set on each server into one central list.
sat_id is the Big List
sat_id_raw is the variable that I set earlier in the automation.

What am I missing here?
Thanks in advance

Try "{{ sat_id + sat_id_raw }}" if sat_id_raw is a list, "{{ sat_id + [sat_id_raw] }}" if sat_id_raw is
a single value.

Regards
          Racke

Many thanks, I’ll give it a try.

Greg