---- hosts: "{{hostList}}" vars_files: - "{{file}}" tasks: - debug: var=inventory_hostname[servers]one ansible_connection=localtwo ansible_connection=local
hostList: - one - two
PLAY [[u'one', u'two']] *****************************************************************************************************************************************************************************
TASK [Gathering Facts] ******************************************************************************************************************************************************************************ok: [two]ok: [one]
TASK [debug] ****************************************************************************************************************************************************************************************ok: [one] => { "inventory_hostname": "one"}ok: [two] => { "inventory_hostname": "two"}
PLAY RECAP ******************************************************************************************************************************************************************************************one : ok=2 changed=0 unreachable=0 failed=0two : ok=2 changed=0 unreachable=0 failed=0
hostList: one, two
PLAY [one, two] *************************************************************************************************************************************************************************************
TASK [Gathering Facts] ******************************************************************************************************************************************************************************ok: [one]ok: [two]
TASK [debug] ****************************************************************************************************************************************************************************************ok: [one] => { "inventory_hostname": "one"}ok: [two] => { "inventory_hostname": "two"}
PLAY RECAP ******************************************************************************************************************************************************************************************one : ok=2 changed=0 unreachable=0 failed=0two : ok=2 changed=0 unreachable=0 failed=0