0

I have some problems with ansible and aruba aoscx (model 8325),I did a simple installation with just a host and a playbook, they work for the vlan and banner config but when I want to do the interfaces there is a problem. So I searched on forums and installed the requirements.txt and .yml but after that my simple vlan configuration playbook don't work anymore. And when I don't install the requirements.txt and .yml the vlans work but not the interface because some modules are missing.

I have tried to change my connection method (currently it is with api :"8325-data ansible_host= ansible_user= ansible_password= ansible_connection=httpapi ansible_network_os=aoscx ansible_httpapi_validate_certs=False ansible_httpapi_use_ssl=True ansible_acx_no_proxy=True") and I tried this:

another host in yml but he didn't work.

So at first I try to start my playbook without any modules : Error without modules

and after that I try to install pyaoscx like this previous error said but it didn't worked :

fatal: [test]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  
File \"/root/.ansible/tmp/ansible-local-3218g33sflom/ansible-tmp-1681219383.9224215-3271-232635014444859/AnsiballZ_aoscx_interface.py\", line 102, in <module>\n    _ansiballz_main()\n  
File \"/root/.ansible/tmp/ansible-local-3218g33sflom/ansible-tmp-1681219383.9224215-3271-232635014444859/AnsiballZ_aoscx_interface.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  
File \"/root/.ansible/tmp/ansible-local-3218g33sflom/ansible-tmp-1681219383.9224215-3271-232635014444859/AnsiballZ_aoscx_interface.py\", line 40, in invoke_module\n  
runpy.run_module(mod_name='ansible.modules.aoscx_interface', init_globals=None, run_name='__main__', alter_sys=True)\n  
File \"/usr/lib/python3.9/runpy.py\", line 210, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  
File \"/usr/lib/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  
File \"/usr/lib/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  
File \"/tmp/ansible_aoscx_interface_payload_0ce255zt/ansible_aoscx_interface_payload.zip/ansible/modules/aoscx_interface.py\", line 477, in <module>\n  
File \"/tmp/ansible_aoscx_interface_payload_0ce255zt/ansible_aoscx_interface_payload.zip/ansible/modules/aoscx_interface.py\", line 429, in main\n  
File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/pyaoscx_factory.py\", line 22, in __call__\n    cls.__instance = super(Singleton, cls).__call__(*args, **kwargs)\n  
File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/device.py\", line 36, in __init__\n    self.get_firmware_version()\n  
File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/pyaoscx_module.py\", line 39, in ensure_connected\n    return fnct(self, *args, **kwargs)\n  
File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/device.py\", line 199, in get_firmware_version\n    data = self.get_firmware_info()\n  
File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/pyaoscx_module.py\", line 39, in ensure_connected\n    
return fnct(self, *args, **kwargs)\n  
File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/device.py\", line 218, in get_firmware_info\n    
raise GenericOperationError(response.text, response.status_code)\npyaoscx.exceptions.generic_op_error.GenericOperationError: 'GENERIC OPERATION ERROR: Missing CSRF token: Code: 403'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

My playbook for the interfaces :

- hosts: all
  roles:
    - role: arubanetworks.aoscx_role
  tasks:
    - name: test
      aoscx_interface:
        name: 1/1/1
        description: "with ansible"

And this playbook for vlan working currently :

- hosts: all
  roles:
    - role: arubanetworks.aoscx_role
  tasks:
    - name: Create Vlan 300
      aoscx_vlan:
        vlan_id: "300"
        description: "with ansible" 

When I install the requirements.txt and .yml I have this issues :

pyaoscx.exceptions.generic_op_error.GenericOperationError: 'GENERIC OPERATION ERROR: Missing CSRF token: Code: 403'
fatal: [test]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  
File \"/root/.ansible/tmp/ansible-local-2734ibid8snz/ansible-tmp-1681219182.6246307-2787-110852312667305/AnsiballZ_aoscx_vlan.py\", line 102, in <module>\n    _ansiballz_main()\n  
File \"/root/.ansible/tmp/ansible-local-2734ibid8snz/ansible-tmp-1681219182.6246307-2787-110852312667305/AnsiballZ_aoscx_vlan.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  
File \"/root/.ansible/tmp/ansible-local-2734ibid8snz/ansible-tmp-1681219182.6246307-2787-110852312667305/AnsiballZ_aoscx_vlan.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible.modules.aoscx_vlan',
 init_globals=None, run_name='__main__', alter_sys=True)\n  
File \"/usr/lib/python3.9/runpy.py\", line 210, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  
File \"/usr/lib/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  
File \"/usr/lib/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n
File \"/tmp/ansible_aoscx_vlan_payload_5mgje5cx/ansible_aoscx_vlan_payload.zip/ansible/modules/aoscx_vlan.py\", line 215, in <module>\n  
File \"/tmp/ansible_aoscx_vlan_payload_5mgje5cx/ansible_aoscx_vlan_payload.zip/ansible/modules/aoscx_vlan.py\", line 135, in main\n  
File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/pyaoscx_factory.py\", line 22, in __call__\n    cls.__instance = super(Singleton, cls).__call__(*args, **kwargs)\n  
File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/device.py\", line 36, in __init__\n    self.get_firmware_version()\n  
File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/pyaoscx_module.py\", line 39, in ensure_connected\n    return fnct(self, *args, **kwargs)\n  
File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/device.py\", line 199, in get_firmware_version\n    data = self.get_firmware_info()\n  
File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/pyaoscx_module.py\", line 39, in ensure_connected\n    return fnct(self, *args, **kwargs)\n  
File \"/usr/local/lib/python3.9/dist-packages/pyaoscx/device.py\", line 218, in get_firmware_info\n    
raise GenericOperationError(response.text, response.status_code)\npyaoscx.exceptions.generic_op_error.GenericOperationError: 'GENERIC OPERATION ERROR: Missing CSRF token: Code: 403'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

(Thanks for the informations about bad practices I tried to edit as I can)

[SOLVED]

Someone helped me, actually in my configuration I mixed two methods, So to fix this just go through the installation of the requirements and the collections: 1- install ansible 2- install ansible collection arubanetworks aoscx :

ansible-galaxy collection install arubanetworks.aoscx

3- install both requirements :

ansible-galaxy install -r requirements.yml

python3 -m pip install -r requirements.txt

For the playbooks :

- hosts: all
  collections:
    - arubanetworks.aoscx
  vars:
    ansible_python_interpreter: /usr/bin/python3
  gather_facts: False
  tasks:
    - name: test
      aoscx_interface:
        name: 1/1/1
        description: "with ansible"

and in the host file (the switch) you have to put :

8325-data ansible_host=<host> ansible_user=<user> ansible_password=<password> ansible_connection=arubanetworks.aoscx.aoscx ansible_network_os=aoscx ansible_httpapi_validate_certs=False ansible_httpapi_use_ssl=True ansible_acx_no_proxy=True
Nsso
  • 1
  • 1
  • Please [edit] your question and add the **code, logs, output, error messages... directly in the question body as code blocks**. Using images for this has [numerous disadvantages](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question/285557#285557) and is specifically listed as a bad practice in [ask]. Thanks – Zeitounator Apr 11 '23 at 12:25
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Apr 11 '23 at 12:52

0 Answers0