Hi,

It's difficult to understand what you want to do... Perhaps you should explain in plain english before trying to code it ?

In your code, there's a "hosts" directive in your inventory.... You should not have it in this file ("hosts" directive is for playbooks)

If you have multiple inventory, perhaps a way to select which inventory to select is to add an argument to your running playbook

ansible-playbook -i /home/ansible/MACCABI/hosts/POC_ENV.yml myplaybook.yml


Regards,

Le 30/12/2019 à 11:07, Yehuda Pinhas a écrit :

    Hi,

Can you please take a look on my errors and try to help me figuring out why I am getting them?

This is my inventory code:
  - hosts: localhost
vars:
my_hosts:
        - group: 'POC_ENV'
hosts: "{{ lookup('file',
                     '/home/ansible/MACCABI/hosts/POC_ENV.yml').splitlines() }}"
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

This is my playbook code (task is to add a VLAN):
name: Playing VLAN Configuration
hosts: POC-ENV
connection: local
vars:
vlan_id: 999
vlan_name: TEST_VLAN_TEST
tasks:
    - include_role:
name: add_vlan
name: show_vlan


This is the errors I get:

Ansible add vlans errors.PNG


Thanks!
















--
You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com <mailto:ansible-project+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/512c2e73-247b-400c-a6d9-fe5afb947d1f%40googlegroups.com <https://groups.google.com/d/msgid/ansible-project/512c2e73-247b-400c-a6d9-fe5afb947d1f%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/fea3d260-f83b-8fd5-d60a-337564363f13%40lenhof.eu.org.

Reply via email to