Hello,
I did param 2 entries in my hosts file:
[server]
localhost ansible_connection=local ansible_user=fvaltat PARAM=“[‘tomweb’, ‘’, ‘Y’,‘1’]”
localhost ansible_connection=local ansible_user=fvaltat PARAM=“[‘openhr’, ‘7.30.060’, ‘Y’,‘2’]”
In my playbook, I did set the hosts to server:
- hosts: server
become: False
become_user: root
roles: - listparam
and I do display the variables using the debug module in the main.yml of the listparam/tasks directory:
- debug: msg=“DISPLAY variables from an array PARAM {{ param }} - param[0]-module {{ param[0] }} - param[1]-release {{ param[1] }} - param[2]-tomtools {{ param[2] }} - param[3]-instance {{ param[3] }}”
But when I run the playbook, I only display the 2nd entry of the hosts file, why doesn’t it run the playbook for the 1st entry ?
ansible-playbook -i ./hosts test_host.yml
PLAY [server] *******************************************************************
TASK [setup] *******************************************************************
ok: [localhost]
TASK [listparam : debug] *******************************************************
ok: [localhost] => {
“msg”: “DISPLAY variables from an array PARAM [‘openhr’, ‘7.30.060’, ‘Y’, ‘2’] - param[0]-module openhr - param[1]-release 7.30.060 - param[2]-tomtools Y - param[3]-instance 2”
}
I do expect to have this display too :
TASK [listparam : debug] *******************************************************
ok: [localhost] => {
“msg”: “DISPLAY variables from an array PARAM [‘tomweb’, ‘’, ‘Y’, ‘1’] - param[0]-module tomweb - param[1]-release - param[2]-tomtools Y - param[3]-instance 1”
}