patternMinor
ansible tower_project module, always getting "ansible-tower-cli required for this module"
Viewed 0 times
thisalwaysmodulegettingclifortoweransiblerequiredtower_project
Problem
I have a control host that has the following:
tower-cli is able to connect to a remote Ansible Tower instance (note, Ansible tower itself is not installed on this control host). Can run 'tower-cli user list' on control host and works as expected.
However, when I try to use a playbook with the tower_* modules, such as:
Always getting the following:
ansible-tower-cli required for this module
Any ideas, as I can use tower-cli just fine on this localhost that is running the playbook.
- ansible --version = 2.5.2
- tower-cli --version == 3.3.0
tower-cli is able to connect to a remote Ansible Tower instance (note, Ansible tower itself is not installed on this control host). Can run 'tower-cli user list' on control host and works as expected.
However, when I try to use a playbook with the tower_* modules, such as:
tasks:
- name: create the SCM project
tower_project:
name: "test project"
state: present
...Always getting the following:
ansible-tower-cli required for this module
Any ideas, as I can use tower-cli just fine on this localhost that is running the playbook.
Solution
Found the origin of the issue, and unless someone else had run into it they wouldn't have known where to look --
check details of
/usr/lib/python2.6/site-packages/ansible
/usr/lib/python3.4/site-packages/tower_cli
If you cannot see the python version using the above for tower-cli, you can run:
The ansible modules couldn't see the tower_cli python modules as they were in a different python environment.
After-the-fact problem origin: I had installed
Centos/RHEL:
-OR-
Python:
Python:
check details of
tower-cli --version and ansible --version, as well as which tower-cli which ansible; in my case were installed in different python environments:/usr/lib/python2.6/site-packages/ansible
/usr/lib/python3.4/site-packages/tower_cli
If you cannot see the python version using the above for tower-cli, you can run:
$ head -n1 `which tower-cli`
#!/usr/local/opt/python/bin/python3.7
$The ansible modules couldn't see the tower_cli python modules as they were in a different python environment.
After-the-fact problem origin: I had installed
ansible via yum (package manager), and ansible-tower-cli via pip (python installer). Being consistent in how you install both to make sure they go to the same environment resolves the issue.Centos/RHEL:
yum install ansible ansible-tower-cli-OR-
Python:
pip install ansiblePython:
pip install ansible-tower-cliCode Snippets
$ head -n1 `which tower-cli`
#!/usr/local/opt/python/bin/python3.7
$Context
StackExchange DevOps Q#4223, answer score: 2
Revisions (0)
No revisions yet.