Hi guys!
Inventory POC_ENV.yml file:
all:
children:
POC_ENV:
hosts:
TEST-NXOS2
TEST-NXOS3
vars:
ansible_ssh_private_key_file: /home/ansible/.ssh/id_rsa
ansible_ssh_common_args: -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
ansible_user: ansible
Playbook new_vlan_playbook.yml file:
---
- name: --------------- 1. Applying Layer 2 Configuration ---------------
hosts: POC_ENV
connection: local
tasks:
- include_vars:
dir: /etc/ansible/roles/new_vlan/vars/
- include_role:
name: new_vlan
tasks_from: add_vlan.yml
- name: --------------- 3. Applying Layer 3 Configuration ---------------
hosts: POC_ENV
connection: local
tasks:
- include_vars:
dir: /etc/ansible/roles/new_vlan/vars/
- include_role:
name: new_vlan
tasks_from: create_svi.yml
# Final result = create VLAN and SVI for predefined group
When im running my code when my inventory file mentions only one of the machines TEST-NXOS2/TEST-NXOS3 the code is working perfectly.
But when adding a second host (doesn't matter if NXOS2 or 3 is added) the code fails with this error:

Working run proof on one host:

What am I missing here?
Am I supposed to tell it to run for each line in POC_ENV.yml file or is it already supposed to know it? because from what I understand ansible is supposed to run on all hosts in parallel and not itterate one by one..
Thanks in advance,
YP