aruba / aruba-switch-ansible

**Deprecated Repository** for ArubaOS-switch and ArubaOS-CX
Apache License 2.0
58 stars 25 forks source link

arubaoss_tasks_config_example.yml "Store Global variables..." block #12

Closed t385f559 closed 5 years ago

t385f559 commented 5 years ago

I am getting the same error over the top block in the aruba_oss_tasks_example.yml over the lines 25-31:

tasks:

Store Global variables. These are also used by other plays in this playbook

- name: Store Global variables in localhost
  block:
    - set_fact:
        site_data: "{{ hostvars[groups[site][0]] }}"
    - set_fact:
        sw_group_name: "{{ site_data.sw_group_name }}"  # Group for the Switches

The error is:

TASK [set_fact] **** task path: /home/user/aruba-switch-ansible/arubaoss_module_config_example.yml:33 fatal: [localhost]: FAILED! => { "msg": "The task includes an option with an undefined variable. The error was: 'group' is undefined\n\nThe error appears to be in '/home/user/aruba-switch-ansible/arubaoss_module_config_example.yml': line 33, column 11, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n block:\n - set_fact:\n ^ here\n" }

I know it says line 33, but line 33 is comments so I was guessing it was what was right before it.

Questions: 1) What is "{{ hostvars[groups[site][0]] }}" calling? the name of the folder is host_vars and group is only found in branch1_switches.
2) could you post the hosts.ini in etc/ansible that would be with an associated switch? Should this be left unedited? Should we use IPs for this?

My setup is a test setup, so I am just trying to do this on one aos switch and no cx devices. If I can provide you any more detail, please let me know