Run ansible on windows host from within the docker container kerberos issues)

We use awx in a docker container.
Sometimes it would be easier to run ansible command line command from within the docker container.

But then it says
“msg”: “winrm or requests is not installed: No module named ‘winrm’”

What do I need to configure that I can run ansible command line from wihtin the awx_task container for troubleshooting purposes

You will need to install some python packages within the AWX_TASK container along with installation of packages on how you plan to authenticate. The recommended approach is to use Kerberos rather than CREDSSP or NTLM, so refer to the part of instructions that applies to best to your environment.

https://docs.ansible.com/ansible-tower/latest/html/administration/kerberos_auth.html
https://docs.ansible.com/ansible/latest/user_guide/windows_winrm.html

For example, the python package that would be needed is “pywinrm[kerberos]” for kerberos authenticated winrm

Also, I had created an Ansible role that deploys and updates Ansible AWX, and one of the playbooks is for “post-install” tasks such as deploying the needed packages each and every time the container(s) are destroyed and rebuilt. Below is the post-install playbook that demonstrates how we can leverage the docker cli to run a task against the container without going into it. There is likely a much better way, but I couldn’t seem to find the answer using any dedicated ansible module for containers management… Let me know if any of you have a better approach using docker compose etc, and how to do it.

Comment is incorrect on last line… that just upgrades the python pip program.