0

I'm trying to use this repo as an Ansible Module,

So I git cloned it, went into the examples folder and tried to run :

export ANSIBLE_LIBRARY=/home/XXX/ansible-for-nsxt-master
ansible-playbook -vvv deploy_nsx_cluster/02_configure_compute_manager.yml

And the main error is :

fatal: [127.0.0.1]: FAILED! => {
    "msg": "Could not find imported module support code for nsxt_fabric_compute_managers.  Looked for either request.py or vmware_nsxt.py"
}

It seems that the module (library/nsxt_fabric_compute_managers.py) is looking for a module_utils named vmware_nsxt.py which is actually present located in module_utils/vmware_nsxt.py

I tried to set the module_utils variable inside my ansible.cfg directly to the module_utils folder and other tweaks like that but I still get this error.

I can't find a way to use this module, could someone help me ?

Here is the ansible --version output of my environment :

ansible 2.9.16
  config file = None
  configured module search path = ['/home/neito/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/neito/.local/lib/python3.6/site-packages/ansible
  executable location = /home/neito/.local/bin/ansible
  python version = 3.6.8 (default, May  6 2020, 12:04:35) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

I'm working on an offline RHEL7.9 machine that's why I'm not on ansible 2.10

NeitoFR
  • 716
  • 1
  • 11
  • 23
  • 2
    my 2 cent since this not a role nor a collection you can cleanly install: run the playbook from the root of the project where it should find everything without any other changes: `cd /home/xxx/ansible-for-nsxt-master && ansible-playbook -vvv examples/deploy_nsx_cluster/02_configure_compute_manager.yml` – Zeitounator Jan 04 '21 at 17:51
  • Unfortunately it's not the solution... It's still looking for vmware_nsxt.py when executing `ansible-playbook` at the root of this folder. – NeitoFR Jan 05 '21 at 09:59
  • My bad: `cd /home/xxx/ansible-for-nsxt-master && cp examples/deploy_nsx_cluster/* . && ansible-playbook 02_configure_compute_manager.yml`. This should definitely be transformed to a proper ansible collection for an easy installation and usage.I suggest you vote for the [corresponding feature request](https://github.com/vmware/ansible-for-nsxt/issues/290) – Zeitounator Jan 05 '21 at 10:18
  • Hey ! You are right :) it's working. so I need to have `library` and `module_utils` folder at the same level than my playbook ? As long as it is not formatted as a proper ansible collection, it can cannot be used in a cleaner way ? I voted for the feature as you advised. Thanks again – NeitoFR Jan 05 '21 at 14:45
  • 1
    `it can cannot be used in a cleaner way ?` => Make a collection yourself and copy the code in there ;) – Zeitounator Jan 05 '21 at 14:57

0 Answers0