A Red Hat product that allows you to run Ansible with a web GUI. In the operation part, Ansible Engin is also running, but it was a little different from going inside the server and running Ansible. It is not a standard module that can be used when Ansible is installed, but what should I do to move the additionally installed module? The environment is as follows.
Official procedure for how to add a module with standard Ansible ) It will go smoothly. What I'm addicted to this time is that it works when I go inside the server and run Ansible, but it doesn't work from Tower. .. It seemed to be bald because other errors also occurred.
It has nothing to do with adding modules, but in the modules I added, the Python used must be 3 instead of 2, "ansible_python_interpreter" /reference_appendices/python_3_support.html) specified to use Python3 which was additionally installed in RHEL7. I was able to run it normally with python3 in normal Ansible, but when I run it with Tower, I get this error. .. ..
AttributeError: module 'enum' has no attribute 'IntFlag'
In conclusion, the following enum34 was bad in my environment, so I fixed it by balsing.
/var/lib/awx/venv/ansible/bin/pip uninstall enum34
Finally the main subject, but after fixing the enum bug above, the next is this error.
<module>ImportError: cannot import name 'ModuleName'
For the first time here, *** Oh, I thought that it could not be read ***, and as a result, there was a place to add an environment variable to the setting of Ansible Tower, ["ANSIBLE_LIBRARY" setting](https: // docs. By registering ansible.com/ansible/latest/dev_guide/developing_locally.html) as JSON, I was able to execute it normally.
{
"ANSIBLE_LIBRARY": "/usr/share/ansible/plugins/modules/<added module name>",
"ANSIBLE_MODULE_UTILS": "/usr/share/ansible/plugins/modules/<added module name>/module_utils/"
}
The location to set is Ansible Tower Settings> Jobs> Additional Environment Variables.
Recommended Posts