aristanetworks / ansible-cvp

Ansible modules for Arista CloudVision
http://cvp.avd.sh
Apache License 2.0
66 stars 61 forks source link

Basic playbook doesn't work - path issue #308

Closed batchenr closed 3 years ago

batchenr commented 3 years ago

Hey with all the data here i really dont understand how to make it work. I have installed all requirements to a docker container of python:3-stretch and run inside the basic 'gather facts' playbook. I used this command also :
ansible-galaxy collection install arista.cvp I can see error is because the cv_facts is trying to reach https://cvp_server:443/command-api and there is no such path.(command-api)

I get the error:

    "ansible_facts": {},
    "changed": false,
    "failed_modules": {
        "ansible.legacy.eos_facts": {
            "exception": "  File \"/tmp/ansible_ansible.legacy.eos_facts_payload_jvqzcoqo/ansible_ansible.legacy.eos_facts_payload.zip/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/network.py\", line 251, in get_capabilities\n    capabilities = Connection(module._socket_path).get_capabilities()\n  File \"/tmp/ansible_ansible.legacy.eos_facts_payload_jvqzcoqo/ansible_ansible.legacy.eos_facts_payload.zip/ansible/module_utils/connection.py\", line 195, in __rpc__\n    raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)\n",
            "failed": true,
            "invocation": {
                "module_args": {
                    "gather_network_resources": null,
                    "gather_subset": [
                        "!config"
                    ],
                    "provider": null
                }
            },
            "msg": "Response was not valid JSON, got <html>\r\n<head><title>404 Not Found</title></head>\r\n<body>\r\n<center><h1>404 Not Found</h1></center>\r\n<hr><center>nginx</center>\r\n</body>\r\n</html>\r\n"
        }
    },
    "msg": "The following modules failed to execute: ansible.legacy.eos_facts\n"
}

Inventory.ini :

[cvp_servers]
cvp01   ansible_httpapi_host=10.10.111.21

[cvp_servers:vars]
ansible_connection = 'httpapi'
ansible_httpapi_use_ssl = True
ansible_httpapi_validate_certs = False
ansible_user = 'Admin_CVP'
ansible_password = 'XXX'
ansible_network_os = 'eos'
ansible_httpapi_port = 443
# Configuration to get Virtual Env information
ansible_python_interpreter = $(which python)

playbook:

---
- name: Playbook to demonstrate cv_container module.
  hosts: cvp_servers
  connection: local
  #gather_facts: no
  collections:
    - arista.cvp
    - arista.avd
  vars:
  vars_files:
            - vars.yml
  tasks:
    - name: "Gather CVP facts from {{inventory_hostname}}"
      cv_facts:
       facts:
               devices
      register: cvp_facts

Role or Module Name

arista.cvp

Ansible version

ansible 2.10.7

list of python packages if required.

ansible==3.1.0
ansible-base==2.10.7
cvprac==1.0.5
httplib2==0.19.0
Jinja2==2.11.3
netaddr==0.8.0
requests==2.25.1
treelib==1.6.1
jsonschema==3.2.0

Cloudvision version

CloudVision version 2020.2.3
UI version 7.3.0

OS running Ansible

Ubuntu 18 is the host of the docker container
container OS is Debian GNU/Linux 9 stretch

Steps to reproduce

Im running from within the container this command :
ansible-playbook -vvv facts.yml -i inventory.ini Any ideas?

batchenr commented 3 years ago

changed playbook like this and worked:

---
- name: Playbook to demonstrate cv_container module.
  hosts: cvp_servers
  connection: local
  gather_facts: no
  collections:
    - arista.cvp
    - arista.avd
  vars:
  vars_files:
            - vars.yml
  tasks:
    - name: "Gather CVP facts from {{inventory_hostname}}"
      arista.cvp.cv_facts:
      register: cv_facts