ImportError: cannot import name iControlUnexpectedHTTPError

Hi all,

I have recently started working with ansible and deployed awx on a local machine.

I have successfully deployed awx using docker container but when I try to create pool on my F5 server.
I am getting the following error:

{
“_ansible_parsed”: false,
“exception”: “Traceback (most recent call last):\n File "/tmp/ansible_btX0YU/ansible_module_bigip_pool.py", line 237, in \n from ansible.module_utils.f5_utils import (\nImportError: cannot import name iControlUnexpectedHTTPError\n”,
“_ansible_no_log”: false,
“_ansible_delegated_vars”: {
“ansible_delegated_host”: “localhost”,
“ansible_host”: “localhost”
},
“module_stderr”: “Traceback (most recent call last):\n File "/tmp/ansible_btX0YU/ansible_module_bigip_pool.py", line 237, in \n from ansible.module_utils.f5_utils import (\nImportError: cannot import name iControlUnexpectedHTTPError\n”,
“changed”: false,
“module_stdout”: “”,
“rc”: 0,
“msg”: “MODULE FAILURE”
}

The script works fine if I try to run it from the cli using ansible-playbook.
Also I checked I am able to ping to the server using awx.

If someone have faced this issue before please let me know the solution.

Thanks
Mrinal

when googling: "ansible.module_utils.f5_utils import (\nImportError: cannot import name iControlUnexpectedHTTPError"

It points to network connectivity–in other words, seems to be an issue where AWX can’t speak to your server.

The script works fine if I try to run it from the cli using ansible-playbook.
Also I checked I am able to ping to the server using awx.

You might want to try running the playbook while exec’d in to the container:

docker exec -it awx_web bash

(may also want to try with awx_task, I don’t think you’d get different results, but worth a try).

Hi John,

At first I thought so too but as you see I am able to ping the f5 boxes.
So network connectivity issue was out of question.

After doing intensive research I was able to figure why this was happening.
I don’t know why but the Docker images were not able to get the f5 modules present in ansible, my best
guess the python interpreter was using the default module location.

So what I did was installed the python f5 modules using pip on the tasks container,
and it started working.

I don’t if its the correct way or not but as long as it work.

Thanks for the reply.

Mrinal

Good find, I’m glad you were able to get it to work! I’m not entirely sure the best practice of installing different modules, seems like what you did worked and I can’t think of any reason why it’d be bad.

John