aruba / aos-switch-ansible-collection

Ansible collection for AOS-Switch switches
67 stars 19 forks source link

arubaoss_facts module not working #80

Closed lhcunha closed 1 year ago

lhcunha commented 1 year ago

I have an Aruba host running Aruba OS version 16.10 as the target. These are the group variables:

ansible_network_os: arubanetworks.aos_switch.arubaoss
ANSIBLE_NETWORK_GROUP_MODULES: arubaoss
ansible_connection: local
ansible_host_key_checking: False
ansible_ssh_host_key_checking: False
host_key_checking: False
ssh_host_key_checking: False
paramiko_host_key_checking: False
ansible_ssh_common_args: '-o userknownhostsfile=/dev/null'

these are the host variables:

ansible_host: 10.61.17.220
sys_os: arubaos_sw
is_core_switch: true

These are the tasks:

- name: Gather arubaos facts
  arubanetworks.aos_switch.arubaoss_facts:
  register: facts_output

- name: Print facts
  debug:
    var: facts_output

When I run the tasks, I get this error:

fatal: [ARUBA_SW.LOJA_LAB_FISICO]: FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "invocation": {
        "module_args": {
            "api_version": "None",
            "gather_network_resources": null,
            "gather_subset": [
                "host_system_info",
                "switch_specific_system_info",
                "module_info",
                "system_power_supply"
            ],
            "host": null,
            "password": null,
            "port": null,
            "provider": null,
            "ssh_keyfile": null,
            "timeout": null,
            "use_ssl": null,
            "username": null,
            "validate_certs": false
        }
    },
    "msg": "Request failed: <urlopen error [Errno -2] Name or service not known>",
    "status": -1,
    "url": "http://None:80/rest/v6.0/login-sessions"
}

What am I missing? Thanks!

alagoutte commented 1 year ago

What ansible and module version?

What configuration of switch ? (show web-management... ?)

lhcunha commented 1 year ago

AWX version: 21.13.0 module version: 1.6.0 Switch config:

web-management ssl
web-management idle-timeout 300
aaa authentication rest login radius local
aaa authentication rest enable radius local

show rest-interface:

 REST Interface - Server Configuration

  REST Interface            : Enabled
  REST Operational Status   : Up
  REST Session Idle Timeout : 600 seconds
  HTTP Access               : Enabled
  HTTPS Access              : Enabled
  SSL Port                  : 443
lhcunha commented 1 year ago

here is the switch version:

ARUBA_SW.LOJA_LAB_FISICO# show version

Image stamp:    /ws/swbuildm/rel_ajanta_qaoff/code/build/lakes(swbuildm_rel_ajanta_qaoff_rel_ajanta)
                Jun  7 2021 21:34:42
                YA.16.10.0015
                930
Boot Image:     Primary

Boot ROM Version:    YA.15.20

Im not sure if it is AOS or PVOS. Does the facts module work with the AOS switches?

tchiapuziowong commented 1 year ago

@lhcunha the definition of ANSIBLE_NETWORK_GROUP_MODULES=arubaoss must be in the ansible.cfg file - you can put it in the root of the project where your playbooks are stored - can you try that and see if that improves the error? example ansible.cfg:

[defaults]
NETWORK_GROUP_MODULES=arubaoss
lhcunha commented 1 year ago

I'm running this project on AWX and I dont have access to the ansible.cfg file. Considering this, can I set this variable on the group or host var?

tchiapuziowong commented 1 year ago

@lhcunha how are you storing/importing your playbooks? if you have an SCM like Git/Github you can just put the ansible.cfg file in the same directory as your playbooks

tchiapuziowong commented 1 year ago

@lhcunha this is what Ansible says regarding ansible.cfg and AWX/Tower/Ansible Controller: https://docs.ansible.com/ansible-tower/latest/html/administration/tipsandtricks.html#locate-and-configure-the-ansible-configuration-file

lhcunha commented 1 year ago

@tchiapuziowong Due to our strict time left, I chose to perform the same goal connecting to de switch's API using the ansible uri module and it worked. With that said, I think we can close this issue. For informative purposes, my guess is that a firewall rule between the AWX and the target switch was causing this reported issue, because I got a similar error when using the uri module and the offender was a FW rule. Thanks for your time.