Manage Windows like Linux with Ansible?

@syntaxerrormmm
Can you help?

Would love to help/develop that, would be yet another great tool in NS’s sleeves.
The main issue here is that I don’t have time for yet another project, sorry :confused:

If the project takes on, please add me to the thread, would love to follow its development and at least test something if needed.

I tried to install AWX based on this HowTo: install-ansible-tower-awx-centos-7

And got this error:
TASK [local_docker : Start the containers] ***************************************************************************************************
task path: /root/awx/installer/roles/local_docker/tasks/compose.yml:45
fatal: [localhost]: FAILED! => {“changed”: false, “msg”: “Failed to import the required Python library (Docker SDK for Python: docker (Python >= 2.7) or docker-py (Python 2.6)) on infra04.mydomain.lan’s Python /usr/bin/python3. Please read module documentation and install in the a ppropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter, for example via pip install docker or pip install docker-py (Python 2.6). The error was: No module named ’ requests’”}

PLAY RECAP **********************************************************************************************************
localhost : ok=14 changed=2 unreachable=0 failed=1 skipped=95 rescued=0 ignored=0

That’s the interesting part of the error trace. When I tried the official guide on a Debian host, I had similar issues. Although, just retry installing the package python-requests first.

Package python-requests-2.6.0-9.el7_8.noarch already installed and latest version

Which version of python you have on the machine (python --version)? Which version is the installer using? I suspect the installer wants python 2.7 (which is also installed on a NS machine I just checked and updated) but you have 2.6.

[root@infra04 ~]# python --version
Python 2.7.5

Can you see the issue now?

OK and what can I do now on NS?

Can someone help with infos howto install ansible on Nethserver 7.9?

Tried to install it with this HowTo: How to setup Ansible to manage Windows hosts with Centos 7

But if I try to update pip the following error came up:

You can try to upgrade setup tools before

pip install --upgrade setuptools

Please try

python -m pip install --upgrade pip

Can’t you use python3?

python3 pip install --upgrade pip

After this I have no more ideas. Perhaps @mrmarkuz can help.

Thank you! Lets see…

This should work but changes the systems python3.

If possible use a venv, this way systems python stays untouched and only pip in the virtual environment is updated.

# Create venv
python3 -m venv /opt/ansible
# Enter venv
source /opt/ansible/bin/activate

Example of updating pip in a virtualenv:

[root@testserver ~]# python -V
Python 2.7.5

[root@testserver ~]# python3 -V
Python 3.6.8

[root@testserver ~]# python3 -m pip -V
pip 9.0.3 from /usr/lib/python3.6/site-packages (python 3.6)

[root@testserver ~]# source /opt/ansible/bin/activate
(ansible) [root@testserver ~]# python -V
Python 3.6.8

(ansible) [root@testserver ~]# pip -V
pip 9.0.3 from /opt/ansible/lib64/python3.6/site-packages (python 3.6)

(ansible) [root@testserver ~]# pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/ca/31/b88ef447d595963c01060998cb329251648acf4a067721b0452c45527eb8/pip-21.2.4-py3-none-any.whl (1.6MB)
    100% |████████████████████████████████| 1.6MB 885kB/s
Installing collected packages: pip
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
      Successfully uninstalled pip-9.0.3
Successfully installed pip-21.2.4

(ansible) [root@testserver ~]# pip -V
pip 21.2.4 from /opt/ansible/lib64/python3.6/site-packages/pip (python 3.6)

Another way is to use Software Collections to use more recent versions of python. @stephdl provides different scl python versions with additional options.

Here is an example of using rh-python38:

yum -y install rh-python38
scl enable rh-python38 bash

# create virtual environment
python -m venv /opt/ansible

# enter virtual environment
source /opt/ansible/bin/activate
pip install --upgrade pip

Another example: Matrix-synapse uses rh-python36.

1 Like

Hi Markus, this went well:

But if I try to install pip install pywinrm[Kerberos] I get the next error:

I thought a higher version of python is needed but in the howto you posted Python 2.7 is used. Only the pip upgrade does not work, it’s just a warning and can be ignored.
The installation of pywinrm for kerberos works.

yum -y install python-devel krb5-devel krb5-libs krb5-workstation python-pip bind-utils ansible
pip install pywinrm[Kerberos]
1 Like