davidban77 / ansible-collection-gns3

Ansible Collection for GNS3 Server REST API using gns3fy
https://galaxy.ansible.com/davidban77/gns3
MIT License
38 stars 20 forks source link

Error while installing davidban77.gns3 #15

Closed nabilovski closed 4 years ago

nabilovski commented 4 years ago

This happened to me while trying use the first example: what I did: pip install gns3fy mazer this was installed normally

but this one didn't: mazer install davidban77.gns3 Error loading configuration file /root/.ansible/mazer.yml: mapping values are not allowed here in "/root/.ansible/mazer.yml", line 4, column 16 Thanks.

davidban77 commented 4 years ago

It looks like you have an issue on your /root/.ansible/mazer.yml file configuration.

Can you take a look at your mazer file?. Here is an example one from Ansible doc:

version: 1
server:
  ignore_certs: false
  url: https://galaxy-qa.ansible.com
  api_key: da39a3ee5e6b4b0d3255bfef95601890afd80709
collections_path: ~/.ansible/collections
global_collections_path: /usr/share/ansible/collections

The error says mapping values are not allowed here, so my guess is that some variable is not set correctly

davidban77 commented 4 years ago

Also, could it be that mazer was not installed correctly? Can you run pip install mazer to validate the installation went well?

FYI: Mazer is the command line new in 2.8 to install Ansible Collections like this one. If you want more info

nabilovski commented 4 years ago

this is the mazer installation: pip3 install mazer Requirement already satisfied: mazer in /usr/local/lib/python3.6/site-packages (1.0.0) Requirement already satisfied: jinja2 in /usr/local/lib/python3.6/site-packages (from mazer) (2.10.1) Requirement already satisfied: semantic-version in /usr/local/lib/python3.6/site-packages (from mazer) (2.8.2) Requirement already satisfied: attrs>=18.1.0 in /usr/local/lib/python3.6/site-packages (from mazer) (19.1.0) Requirement already satisfied: yamlloader in /usr/local/lib/python3.6/site-packages (from mazer) (0.5.5) Requirement already satisfied: requests in /usr/local/lib/python3.6/site-packages (from mazer) (2.22.0) Requirement already satisfied: PyYaml in /usr/local/lib64/python3.6/site-packages (from mazer) (5.1.2) Requirement already satisfied: six in /usr/local/lib/python3.6/site-packages (from mazer) (1.12.0) Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib64/python3.6/site-packages (from jinja2->mazer) (1.1.1) Requirement already satisfied: idna<2.9,>=2.5 in /usr/local/lib/python3.6/site-packages (from requests->mazer) (2.8) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/site-packages (from requests->mazer) (2019.9.11) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.6/site-packages (from requests->mazer) (3.0.4) Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.6/site-packages (from requests->mazer) (1.25.6)

and the .ansible/mazer.yml I have the same output you have mentioned in the .ansible/mazer.yml or should the api-key be different?

davidban77 commented 4 years ago

It will be different when you submit code to Ansible galaxy. So you don't need to worry about that for this case.

Now, is the ansible and mazer installed in the same python environment?

I see that before you ran pip install gns3fy mazer and the output above is from pip3 install mazer, could it be that the mazer and ansible are in different python versions/environments?

nabilovski commented 4 years ago

Yes they are both on the same python env: (mypython3) root@server1:~ ✔ pip3 install ansible Requirement already satisfied: ansible in ./mypython3/lib/python3.6/site-packages (2.8.5) Requirement already satisfied: cryptography in ./mypython3/lib/python3.6/site-packages (from ansible) (2.7) Requirement already satisfied: PyYAML in ./mypython3/lib/python3.6/site-packages (from ansible) (5.1.2) Requirement already satisfied: jinja2 in ./mypython3/lib/python3.6/site-packages (from ansible) (2.10.1) Requirement already satisfied: cffi!=1.11.3,>=1.8 in ./mypython3/lib/python3.6/site-packages (from cryptography->ansible) (1.12.3) Requirement already satisfied: asn1crypto>=0.21.0 in ./mypython3/lib/python3.6/site-packages (from cryptography->ansible) (0.24.0) Requirement already satisfied: six>=1.4.1 in ./mypython3/lib/python3.6/site-packages (from cryptography->ansible) (1.12.0) Requirement already satisfied: MarkupSafe>=0.23 in ./mypython3/lib/python3.6/site-packages (from jinja2->ansible) (1.1.1) Requirement already satisfied: pycparser in ./mypython3/lib/python3.6/site-packages (from cffi!=1.11.3,>=1.8->cryptography->ansible) (2.19)


(mypython3) root@server1:~ ✔ pip3 install mazer Requirement already satisfied: mazer in ./mypython3/lib/python3.6/site-packages (1.0.0) Requirement already satisfied: attrs>=18.1.0 in ./mypython3/lib/python3.6/site-packages (from mazer) (19.2.0) Requirement already satisfied: yamlloader in ./mypython3/lib/python3.6/site-packages (from mazer) (0.5.5) Requirement already satisfied: PyYaml in ./mypython3/lib/python3.6/site-packages (from mazer) (5.1.2) Requirement already satisfied: requests in ./mypython3/lib/python3.6/site-packages (from mazer) (2.22.0) Requirement already satisfied: jinja2 in ./mypython3/lib/python3.6/site-packages (from mazer) (2.10.1) Requirement already satisfied: six in ./mypython3/lib/python3.6/site-packages (from mazer) (1.12.0) Requirement already satisfied: semantic-version in ./mypython3/lib/python3.6/site-packages (from mazer) (2.8.2) Requirement already satisfied: certifi>=2017.4.17 in ./mypython3/lib/python3.6/site-packages (from requests->mazer) (2019.9.11) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./mypython3/lib/python3.6/site-packages (from requests->mazer) (3.0.4) Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./mypython3/lib/python3.6/site-packages (from requests->mazer) (1.25.6) Requirement already satisfied: idna<2.9,>=2.5 in ./mypython3/lib/python3.6/site-packages (from requests->mazer) (2.8) Requirement already satisfied: MarkupSafe>=0.23 in ./mypython3/lib/python3.6/site-packages (from jinja2->mazer) (1.1.1)


(mypython3) root@server1:~ ✔ pip3 install gns3fy Requirement already satisfied: gns3fy in ./mypython3/lib/python3.6/site-packages (0.5.2) Requirement already satisfied: pydantic in ./mypython3/lib/python3.6/site-packages (from gns3fy) (0.32.2) Requirement already satisfied: requests<3.0,>=2.22 in ./mypython3/lib/python3.6/site-packages (from gns3fy) (2.22.0) Requirement already satisfied: dataclasses>=0.6; python_version < "3.7" in ./mypython3/lib/python3.6/site-packages (from pydantic->gns3fy) (0.6) Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./mypython3/lib/python3.6/site-packages (from requests<3.0,>=2.22->gns3fy) (1.25.6) Requirement already satisfied: certifi>=2017.4.17 in ./mypython3/lib/python3.6/site-packages (from requests<3.0,>=2.22->gns3fy) (2019.9.11) Requirement already satisfied: idna<2.9,>=2.5 in ./mypython3/lib/python3.6/site-packages (from requests<3.0,>=2.22->gns3fy) (2.8) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./mypython3/lib/python3.6/site-packages (from requests<3.0,>=2.22->gns3fy) (3.0.4)

davidban77 commented 4 years ago

How does you ansible playbook look like?.

Also can you paste the ansible --version?

I will try to replicate on a docker environment

nabilovski commented 4 years ago

Even though installing the module still gives this error but I still can use the module. The error: (mypython3) root@server1:~ ✔ mazer install davidban77.gns3 Error loading configuration file /root/.ansible/mazer.yml: mapping values are not allowed here in "/root/.ansible/mazer.yml", line 4, column 16


This playbook is for closing a project, and it works fine: (mypython3) root@server1:~ ✔ ansible-playbook gns3_ansible.yml

PLAY [test gns3 with ansible] TASK [Stop lab] ***** changed: [localhost]

PLAY RECAP ** localhost : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0


(mypython3) root@server1:~ ✔ ansible --version ansible 2.8.5 config file = /root/ansible.cfg configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /root/mypython3/lib/python3.6/site-packages/ansible executable location = /root/mypython3/bin/ansible python version = 3.6.8 (default, Aug 7 2019, 17:28:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

davidban77 commented 4 years ago

So it should be ok, a good "keepalive" test is to get the server version.

I added a new module gns3_facts which should get the info of the server.

Take a look at this

nabilovski commented 4 years ago

Thank you very much I appreciate it :).

davidban77 commented 4 years ago

@nabilovski is that now working for you?