Is there an AWX-Supported version of win_ping?

Am I just missing something obvious?

Play:

---
- hosts: all
  gather_facts: false

  tasks:
    - ansible.windows.win_ping:

Output:
[WARNING]: Collection ansible.windows does not support Ansible version

1

2.12.5.post0

2

3

PLAY [all] *********************************************************************13:22:46

4

5

TASK [ansible.windows.win_ping] ************************************************13:22:46

6

ok: [server1]

7

8

PLAY RECAP *********************************************************************13:22:56

9


server1: ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0

Collections:

collections:
   - name: servicenow.itsm
   - name: community.general
   - name: community.network
   - name: ansible.windows

Hello.

[WARNING]: Collection ansible.windows does not support Ansible version

Probably failed to determine the version.
You need to use a version like 2.15.9, not the version with post0.

Thank you, Akira. Yes, the win_ping did succeed and my concern is the complaint about the version. Your comment is quite probably my answer, but I do not understand it.

I’m running a clean install of AWX 23.6.0 with whatever defaults that install has built-in. I don’t know how to use a version like 2.15.9. I believe the 2.15.9 reference is to the underlying Ansible Engine used by the AWX platform, and I have a hard time imagining how I would go about changing that.

The latest version of ansible.windows collection needs ansible-core 2.14 or later.
https://galaxy.ansible.com/ui/repo/published/ansible/windows/

You can use ansible-builder to build a custom images (including, for example, ansible-core 2.15.9).
https://docs.ansible.com/ansible/latest/getting_started_ee/index.html

In addition to @akira6592 words and for others people issues, you may also add a requirements.yml file to your project and specifying collection version.
Something like :

---
collections:
-  name: ansible.windows
   version: 2.X

But easier and cleaner solution is to run a custom image with the version of ansible-core you need

I found my problem. :slight_smile:

In order to make Kerberos work at my company, I did build an EE some time ago with certain components I need. That EE needs an update. Thank you for the pointers!

3 Likes

Any guesses why I see 2.13.13 as the highest available version? AWX is running 2.15.9, so I’d expect that to be available? When I run:

cat <<EOT > execution-environment.yml
---
version: 3
dependencies:
  ansible_core:
    package_pip: ansible-core==2.15.9
  galaxy: requirements.yml
  python: requirements.txt
  
EOT

The error is:


#7 [base 3/5] RUN /usr/bin/python3 -m pip install --no-cache-dir ansible-core==2.15.9
#7 0.798 ERROR: Could not find a version that satisfies the requirement ansible-core==2.15.9 (from versions: 0.0.1a1, 2.11.0b1, 2.11.0b2, 2.11.0b3, 2.11.0b4, 2.11.0rc1, 2.11.0rc2, 2.11.0, 2.11.1rc1, 2.11.1, 2.11.2rc1, 2.11.2, 2.11.3rc1, 2.11.3, 2.11.4rc1, 2.11.4, 2.11.5rc1, 2.11.5, 2.11.6rc1, 2.11.6, 2.11.7rc1, 2.11.7, 2.11.8rc1, 2.11.8, 2.11.9rc1, 2.11.9, 2.11.10rc1, 2.11.10, 2.11.11rc1, 2.11.11, 2.11.12rc1, 2.11.12, 2.12.0b1, 2.12.0b2, 2.12.0rc1, 2.12.0, 2.12.1rc1, 2.12.1, 2.12.2rc1, 2.12.2, 2.12.3rc1, 2.12.3, 2.12.4rc1, 2.12.4, 2.12.5rc1, 2.12.5, 2.12.6rc1, 2.12.6, 2.12.7rc1, 2.12.7, 2.12.8rc1, 2.12.8, 2.12.9rc1, 2.12.9, 2.12.10rc1, 2.12.10, 2.13.0b0, 2.13.0b1, 2.13.0rc1, 2.13.0, 2.13.1rc1, 2.13.1, 2.13.2rc1, 2.13.2, 2.13.3rc1, 2.13.3, 2.13.4rc1, 2.13.4, 2.13.5rc1, 2.13.5, 2.13.6rc1, 2.13.6, 2.13.7rc1, 2.13.7, 2.13.8rc1, 2.13.8, 2.13.9rc1, 2.13.9, 2.13.10rc1, 2.13.10, 2.13.11rc1, 2.13.11, 2.13.12rc1, 2.13.12, 2.13.13rc1, 2.13.13)
#7 0.798 ERROR: No matching distribution found for ansible-core==2.15.9
#7 0.937 WARNING: You are using pip version 22.0.4; however, version 24.0 is available.
#7 0.937 You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.
#7 ERROR: process "/bin/sh -c $PYCMD -m pip install --no-cache-dir $ANSIBLE_INSTALL_REFS" did not complete successfully: exit code: 1

When I run that in my AWX instance, as expected, I get:

[WARNING]: Collection ansible.windows does not support Ansible version 2.13.13

It looks to me like I cannot use Ansible Builder to build an EE that will support ansible.windows. I see 2.14 is required but 2.13.13 is the latest I can build. Does that make sense?

For the record, I’ll add the following line succeeds. I’m able to install v2.15.9 in python. I don’t know why the builder cannot see that version.

python -m pip install ansible-core==2.15.9

could you share your whole execution-environment.yml + requirements.yml + requirements.txt ?

cat <<EOT > execution-environment.yml
---
version: 3
dependencies:
  ansible_core:
    package_pip: ansible-core==2.13.13
  galaxy: requirements.yml
  python: requirements.txt
  
additional_build_files:
  - src: ca.pem
    dest: certs

additional_build_steps:
  append_final:
    - COPY _build/certs/ca.pem /etc/pki/ca-trust/source/anchors/ca.pem
    - RUN update-ca-trust
    - ENV REQUESTS_CA_BUNDLE=/etc/pki/tls/ca.pem
EOT

cat <<EOT > requirements.yml
---
collections:
  - name: servicenow.itsm
EOT

cat <<EOT > requirements.txt
requests
objectpath
netaddr
EOT

Okay. If I run this I can install 2.15.9:

python  -m pip install --no-cache-dir ansible-core==2.15.9

But this fails:

/usr/bin/python3 -m pip install --no-cache-dir ansible-core==2.15.9
Collecting ansible-core==2.15.9
  Could not find a version that satisfies the requirement ansible-core==2.15.9 (from versions: 0.0.1a1, 2.11.0b1, 2.11.0b2, 2.11.0b3, 2.11.0b4, 2.11.0rc1, 2.11.0rc2, 2.11.0, 2.11.1rc1, 2.11.1, 2.11.2rc1, 2.11.2, 2.11.3rc1, 2.11.3, 2.11.4rc1, 2.11.4, 2.11.5rc1, 2.11.5, 2.11.6rc1, 2.11.6, 2.11.7rc1, 2.11.7, 2.11.8rc1, 2.11.8, 2.11.9rc1, 2.11.9, 2.11.10rc1, 2.11.10, 2.11.11rc1, 2.11.11, 2.11.12rc1, 2.11.12)
No matching distribution found for ansible-core==2.15.9

The python that works is:

which python
/appl/python/Python-3.11.1/python

So, I need to figure out how to make python3 work the same as python 3.11.1 (which I built from source.)

I’m naive, so I expected this to fix all my troubles.

sudo ln -s /appl/python/Python-3.11.1/python /usr/bin/python3

And it does … for me, from the CLI. The builder, though, continues to get the same error. Could it have cached the old symlink? (Which was to /etc/alternatives/python3).

Removing and relinking that symlink also failed to fix the problem. The problem seems to be that I’m using my own python, and have no idea how to fix the built-in python. (Not quite true. I’ve done all the upgrade steps on the locally installed python and it always breaks the server, so I gave up on doing it.)

So, I can build Python3.11 from source, but Builder won’t use and I cannot upgrade Python3.6, which seems only to use ansible-core 2.13.13. This is all on RHEL 8.5.

Maybe the Python version in base image that built is 3.8 or older.
ansible-core 2.14 or later needs Python 3.9 or later.

https://docs.ansible.com/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix

If you just want to wipe the WARNING out, in the execution-environment.yml, you can:

  • Explicitly specify Python version by python_interpreter
  • Explicitly specify versions for Ansible and Ansible Runner by ansible_core and ansible_runner
  • Run alternatives by append_base to use python3.11 as python3

This is modified YAML file based on yours:

---
version: 3
dependencies:
  python_interpreter:   βœ…
    package_system: python3.11   βœ…
    python_path: /usr/bin/python3.11   βœ…
  ansible_core:
    package_pip: ansible-core==2.15.9   βœ…
  ansible_runner:   βœ…
    package_pip: ansible-runner==2.3.4   βœ…
  galaxy: requirements.yml
  python: requirements.txt
  
additional_build_files:
  - src: ca.pem
    dest: certs

additional_build_steps:
  append_base:   βœ…
    - RUN alternatives --auto python3   βœ…
  append_final:
    - COPY _build/certs/ca.pem /etc/pki/ca-trust/source/anchors/ca.pem
    - RUN update-ca-trust
    - ENV REQUESTS_CA_BUNDLE=/etc/pki/tls/ca.pem

However, in the first place, it seems that there is no base_image specified.

In such case quay.io/ansible/ansible-runner:latest is used as base_image but note that this is completely outdated and unmaintained about 2 years.

So I strongly recommend you to explicitly specify baes_image. There is a list of example base images:

Or the community-ee-base is good starting point for you:

Of course you can refer to my repo :smile:

1 Like

I will not be able to try these several excellent suggestions until Tuesday at the earliest, but I thank you Gael, Akira, and Kurobobo for all of them. I will certainly try again to upgrade my local Linux from Python3.6 to 3.11. I’m sure that will help. And I will update my environment to call for specific versions. That will also help. And then, yes, I will update the base image I’m calling. I believe that will get me over the hump (again) and I will wish there were some way I could repay the favor of your time. Thank you.

At the same time, I just want to give up. I’m almost 60 and this is all so new to me. I’m an old procedural programmer, and my skills are now legacy. I’ve grieved their loss and I’m moving into this new layered world. I’ll get there. It’s happening. But, how am I supposed to know the default image base of Ansible Builder has been unsupported for 2 years? How am I supposed to internalize all these layers, when I cannot even see them? And then keep up with foundational layers of products that just rot? 8 months ago my script gave me what seemed to be a perfect and clean EE. It worked a charm these many months. It was built on an image that was already defunct and I had no clue.

The ancients used to fear the sea as a bottomless font of chaos. This containerized world feels just like that. I get all the layers of a containerized thing running, go spend a few months extending legacy stuff that’s still making my company money, and come back to find the foundations of my new thing have gone away (again) and weren’t even right when they were working.

Is there some technique to keeping up with this stuff? When months of my life are consumed with completely different worlds?

I will certainly try again to upgrade my local Linux from Python3.6 to 3.11.

This is an additional note just in case, but you don’t need to upgrade locally installed Python. The all steps of building image by Ansible Builder is processed _inside the container. So the versions of Python, Ansible, Ansible Runner, and Collections that we are discussing about here are the versions that will be installed inside the container, not in your local environment.
The configuration I provided is to install Python 3.11 inside the container, and use /usr/bin/python3.11 inside the container to install specific version of Ansible and Ansible Runner.
So again, you don’t need to upgrade locally installed Python. Even if you have locally installed Ansible and Ansible Runner, upgrading them are not required as well.
All steps you should follow are updating your execution-environment.yml and running ansible-builder again.

8 months ago my script gave me what seemed to be a perfect and clean EE. It worked a charm these many months. It was built on an image that was already defunct and I had no clue.

Please don’t be pessimistic. In this truly complex AWX world (yes, even I find it is complex enough), you have identified your requirements, found a way to meet them, and actually achieved them. This is the fact that you were able to meet your requirements, then you have climbed the mountain. You should be proud of that, because it was certainly the solution for you at that point :smiley:

Using OSS seems like an endless adventure. Disruptive changes are released one day without an enough roadmap or change logs. There is no guarantee that a procedure that worked perfectly today will work tomorrow. Maybe I’m β€˜one of whom know AWX a lot’ for you, but to be honest, I also have a lot of experience that go backwards by overlooking major changes in the past :stuck_out_tongue:

Is there some technique to keeping up with this stuff?

It is almost impossible to keep track of updates in detail unless you are very diligent (in issues, PRs, and codes) and keep observing them on a daily basis. It’s not your personal fault. Anyway, OSS is changing too fast and too much for one person to keep up with. If you are using OSS in your company, it is better to work as a team to keep up with it as an organizational issue rather than on your own. Or if the quality the company requires from you is very high, perhaps it is time to switch to a commercial version with paid support.

That said, all we can do personaly is continue to implement what we think is best at the time with the effort we can muster at the time. If you run into trouble in the process, you can turn to the community (as you already did so). Even if it is a deprecated method, even if it is inadequate in the eyes of the experts, if it can indeed fulfill your requirements, then it is a fine solution for you to be proud of.

Have fun with OSS, as we do :smiley:

1 Like

That extra note does help. I definitely thought Builder was working through the local Python. Thank you.

Thank you every bit as much for the encouragement. Hearing it’s tough even for a seasoned hand helps. I’ll cinch my saddle and keep on. :slight_smile:

Kevin

1 Like

Lots of progress. Thank you for the insights! I’m now able to build a successful EE, but it’s failing to connect to Windows servers. My first error was that winrm was not installed, so I added pywinrm to my requirements.txt. My second error was that the Kerberos package was not installed, so I attempted to add the pykerberos package. That attempt is failing. The failure notes that β€œwheel” is not installed, so I added wheel to requirements.txt to no effect.

Am I barking up the right tree? It seems maybe with the old EE, the ansible.windows package was handling the winrm magic internally, but the new ansible.windows package is delegating that responsibility to Python? That would make some sense, and seems to align with my symptoms.

The proposed solution embedded in the error message is that I should:

enable the '--use-pep517' option

I don’t know where I would do that.

Here’s the error from my play:

TASK [ansible.windows.win_ping] ************************************************
task path: /runner/project/ansible/playbooks/demos/win_ping.yml:6
Using module file /runner/requirements_collections/ansible_collections/ansible/windows/plugins/modules/win_ping.ps1
Pipelining is enabled.
<server1> ESTABLISH WINRM CONNECTION FOR USER: user1@domain on PORT 5986 TO server1
fatal: [server1]: UNREACHABLE! => {
    "changed": false,
    "msg": "kerberos: the python kerberos library is not installed",
    "unreachable": true
}

Here are my new build documents after applying coaching:

cat <<EOT > execution-environment.yml
---
version: 3
images:
  base_image: 
    name: quay.io/centos/centos:stream9-minimal
options:
  package_manager_path: /usr/bin/microdnf
dependencies:
  python_interpreter: 
    package_system: python3.11 
    python_path: /usr/bin/python3.11 
  ansible_core:
    package_pip: ansible-core==2.15.9 
  ansible_runner: 
    package_pip: ansible-runner==2.3.4 
  galaxy: requirements.yml
  python: requirements.txt
  
additional_build_files:
  - src: ca.pem
    dest: certs

additional_build_steps:
  append_base: 
    - RUN alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 0
  append_final:
    - COPY _build/certs/ca.pem /etc/pki/ca-trust/source/anchors/ca.pem
    - RUN update-ca-trust
    - ENV REQUESTS_CA_BUNDLE=/etc/pki/tls/ca.pem
EOT

cat <<EOT > requirements.yml
---
collections:
  - name: servicenow.itsm
EOT

cat <<EOT > requirements.txt
wheel
requests
objectpath
netaddr
pywinrm
pykerberos
EOT

And here is my Ansible Builder output with errors:


Ansible Builder is generating your execution environment build context.
File context/_build/requirements.yml is already up-to-date.
File context/_build/requirements.txt had modifications and will be rewritten
Creating context/_build/certs
File context/_build/certs/ca.pem is already up-to-date.
File context/_build/scripts/assemble is already up-to-date.
File context/_build/scripts/install-from-bindep is already up-to-date.
File context/_build/scripts/introspect.py is already up-to-date.
File context/_build/scripts/check_galaxy is already up-to-date.
File context/_build/scripts/check_ansible is already up-to-date.
File context/_build/scripts/entrypoint is already up-to-date.
Ansible Builder is building your execution environment image. Tags: docker-local.rtfx.aepsc.com/ansible-ee-entrustcerts:1.02
Running command:
  docker build -f context/Dockerfile -t docker-local.rtfx.aepsc.com/ansible-ee-entrustcerts:1.02 context
#0 building with "default" instance using docker driver

#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 2.99kB done
#1 DONE 0.0s

#2 [internal] load metadata for quay.io/centos/centos:stream9-minimal
#2 DONE 0.2s

#3 [internal] load .dockerignore
#3 transferring context: 2B done
#3 DONE 0.0s

#4 [base 1/7] FROM quay.io/centos/centos:stream9-minimal@sha256:f85c7d635158f2044cfdf832a04081dd2eace04ff94dfeea1259c11fccffe5b6
#4 DONE 0.0s

#5 [internal] load build context
#5 transferring context: 565B done
#5 DONE 0.0s

#6 [base 2/7] RUN /usr/bin/microdnf install python3.11 -y ; if [ -z  ]; then /usr/bin/microdnf clean all; fi
#6 CACHED

#7 [base 3/7] RUN /usr/bin/python3.11 -m ensurepip
#7 CACHED

#8 [base 5/7] COPY _build/scripts/ /output/scripts/
#8 CACHED

#9 [base 6/7] COPY _build/scripts/entrypoint /opt/builder/bin/entrypoint
#9 CACHED

#10 [base 4/7] RUN /usr/bin/python3.11 -m pip install --no-cache-dir ansible-core==2.15.9 ansible-runner==2.3.4
#10 CACHED

#11 [base 7/7] RUN alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 0
#11 CACHED

#12 [galaxy 1/5] RUN /output/scripts/check_galaxy
#12 CACHED

#13 [galaxy 2/5] COPY _build /build
#13 DONE 0.1s

#14 [galaxy 3/5] WORKDIR /build
#14 DONE 0.1s

#15 [galaxy 4/5] RUN ansible-galaxy role install  -r requirements.yml --roles-path "/usr/share/ansible/roles"
#15 0.576 Skipping install, no requirements found
#15 DONE 0.7s

#16 [galaxy 5/5] RUN ANSIBLE_GALAXY_DISABLE_GPG_VERIFY=1 ansible-galaxy collection install  -r requirements.yml --collections-path "/usr/share/ansible/collections"
#16 3.348 Starting galaxy collection install process
#16 3.348 Process install dependency map
#16 3.348 Starting collection install process
#16 3.348 Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/servicenow-itsm-2.3.0.tar.gz to /root/.ansible/tmp/ansible-local-1jk1l3px8/tmp1xxofivc/servicenow-itsm-2.3.0-pc5008gg
#16 3.348 Installing 'servicenow.itsm:2.3.0' to '/usr/share/ansible/collections/ansible_collections/servicenow/itsm'
#16 3.348 servicenow.itsm:2.3.0 was installed successfully
#16 DONE 3.5s

#17 [builder 1/6] WORKDIR /build
#17 CACHED

#18 [builder 2/6] RUN /usr/bin/python3.11 -m pip install --no-cache-dir bindep pyyaml requirements-parser
#18 CACHED

#19 [builder 3/6] COPY --from=galaxy /usr/share/ansible /usr/share/ansible
#19 CACHED

#20 [builder 4/6] COPY _build/requirements.txt requirements.txt
#20 DONE 0.1s

#21 [builder 5/6] RUN /usr/bin/python3.11 /output/scripts/introspect.py introspect --sanitize --user-pip=requirements.txt --write-bindep=/tmp/src/bindep.txt --write-pip=/tmp/src/requirements.txt
#21 0.374 Creating parent directory for /tmp/src/requirements.txt
#21 0.374 ---
#21 0.374 python:
#21 0.374 - 'wheel  # from collection user'
#21 0.374 - 'requests  # from collection user'
#21 0.374 - 'objectpath  # from collection user'
#21 0.374 - 'netaddr  # from collection user'
#21 0.374 - 'pywinrm  # from collection user'
#21 0.374 - 'pykerberos  # from collection user'
#21 0.374 system: []
#21 0.374
#21 DONE 0.4s

#22 [builder 6/6] RUN /output/scripts/assemble
#22 0.207 ++ source /etc/os-release
#22 0.207 +++ NAME='CentOS Stream'
#22 0.207 +++ VERSION=9
#22 0.207 +++ ID=centos
#22 0.207 +++ ID_LIKE='rhel fedora'
#22 0.207 +++ VERSION_ID=9
#22 0.207 +++ PLATFORM_ID=platform:el9
#22 0.207 +++ PRETTY_NAME='CentOS Stream 9'
#22 0.207 +++ ANSI_COLOR='0;31'
#22 0.207 +++ LOGO=fedora-logo-icon
#22 0.207 +++ CPE_NAME=cpe:/o:centos:centos:9
#22 0.207 +++ HOME_URL=https://centos.org/
#22 0.207 +++ BUG_REPORT_URL=https://bugzilla.redhat.com/
#22 0.207 +++ REDHAT_SUPPORT_PRODUCT='Red Hat Enterprise Linux 9'
#22 0.207 +++ REDHAT_SUPPORT_PRODUCT_VERSION='CentOS Stream'
#22 0.207 ++ echo centos
#22 0.208 + RELEASE=centos
#22 0.208 + PKGMGR=/usr/bin/microdnf
#22 0.208 + PKGMGR_OPTS=
#22 0.208 + PKGMGR_PRESERVE_CACHE=
#22 0.208 + PYCMD=/usr/bin/python3.11
#22 0.208 + PIPCMD='/usr/bin/python3.11 -m pip'
#22 0.208 + /usr/bin/python3.11 -m ensurepip
#22 1.954 Looking in links: /tmp/tmp6ms_pmos
#22 1.955 Requirement already satisfied: setuptools in /usr/local/lib/python3.11/site-packages (65.5.1)
#22 1.956 Requirement already satisfied: pip in /usr/local/lib/python3.11/site-packages (22.3.1)
#22 2.087 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#22 2.162 + '[' -z /usr/bin/microdnf ']'
#22 2.162 + '[' /usr/bin/microdnf = /usr/bin/microdnf ']'
#22 2.162 + '[' -z ']'
#22 2.162 + PKGMGR_OPTS='--nodocs --setopt install_weak_deps=0'
#22 2.162 + mkdir -p /output/bindep
#22 2.163 + mkdir -p /output/wheels
#22 2.165 + mkdir -p /tmp/src
#22 2.166 + cd /tmp/src
#22 2.166 + PACKAGES=
#22 2.166 + PIP_OPTS=
#22 2.166 + install_bindep
#22 2.166 + '[' -f bindep.txt ']'
#22 2.166 + /usr/bin/python3.11 -m venv /tmp/venv --system-site-packages --without-pip
#22 2.214 + source /tmp/venv/bin/activate
#22 2.215 ++ deactivate nondestructive
#22 2.215 ++ '[' -n '' ']'
#22 2.215 ++ '[' -n '' ']'
#22 2.215 ++ '[' -n /bin/bash -o -n '' ']'
#22 2.215 ++ hash -r
#22 2.215 ++ '[' -n '' ']'
#22 2.215 ++ unset VIRTUAL_ENV
#22 2.215 ++ unset VIRTUAL_ENV_PROMPT
#22 2.215 ++ '[' '!' nondestructive = nondestructive ']'
#22 2.215 ++ VIRTUAL_ENV=/tmp/venv
#22 2.215 ++ export VIRTUAL_ENV
#22 2.215 ++ _OLD_VIRTUAL_PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
#22 2.215 ++ PATH=/tmp/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
#22 2.215 ++ export PATH
#22 2.215 ++ '[' -n '' ']'
#22 2.215 ++ '[' -z '' ']'
#22 2.215 ++ _OLD_VIRTUAL_PS1=
#22 2.215 ++ PS1='(venv) '
#22 2.215 ++ export PS1
#22 2.215 ++ VIRTUAL_ENV_PROMPT='(venv) '
#22 2.215 ++ export VIRTUAL_ENV_PROMPT
#22 2.215 ++ '[' -n /bin/bash -o -n '' ']'
#22 2.215 ++ hash -r
#22 2.215 + '[' -f /tmp/src/upper-constraints.txt ']'
#22 2.215 + [[ -n '' ]]
#22 2.215 + install_wheels
#22 2.215 + '[' -f /tmp/src/build-requirements.txt ']'
#22 2.215 + '[' -f setup.py ']'
#22 2.215 + '[' -f /tmp/src/requirements.txt ']'
#22 2.215 + '[' '!' -f /output/requirements.txt ']'
#22 2.215 + /usr/bin/python3.11 -m pip install --cache-dir=/output/wheels -r /tmp/src/requirements.txt
#22 2.725 Collecting wheel
#22 2.897   Downloading wheel-0.42.0-py3-none-any.whl (65 kB)
#22 2.949      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 65.4/65.4 kB 1.1 MB/s eta 0:00:00
#22 3.019 Collecting requests
#22 3.056   Downloading requests-2.31.0-py3-none-any.whl (62 kB)
#22 3.074      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.6/62.6 kB 3.7 MB/s eta 0:00:00
#22 3.107 Collecting objectpath
#22 3.145   Downloading objectpath-0.6.1-py2.py3-none-any.whl (20 kB)
#22 3.192 Collecting netaddr
#22 3.232   Downloading netaddr-1.0.0-py3-none-any.whl (2.3 MB)
#22 3.425      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.3/2.3 MB 11.9 MB/s eta 0:00:00
#22 3.468 Collecting pywinrm
#22 3.505   Downloading pywinrm-0.4.3-py2.py3-none-any.whl (44 kB)
#22 3.511      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 44.1/44.1 kB 8.7 MB/s eta 0:00:00
#22 3.561 Collecting pykerberos
#22 3.599   Downloading pykerberos-1.2.4.tar.gz (25 kB)
#22 3.615   Preparing metadata (setup.py): started
#22 3.888   Preparing metadata (setup.py): finished with status 'done'
#22 4.071 Collecting charset-normalizer<4,>=2
#22 4.109   Downloading charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (140 kB)
#22 4.117      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 140.3/140.3 kB 20.5 MB/s eta 0:00:00
#22 4.158 Collecting idna<4,>=2.5
#22 4.194   Downloading idna-3.6-py3-none-any.whl (61 kB)
#22 4.201      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.6/61.6 kB 10.6 MB/s eta 0:00:00
#22 4.274 Collecting urllib3<3,>=1.21.1
#22 4.311   Downloading urllib3-2.2.0-py3-none-any.whl (120 kB)
#22 4.318      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 120.9/120.9 kB 20.9 MB/s eta 0:00:00
#22 4.365 Collecting certifi>=2017.4.17
#22 4.407   Downloading certifi-2024.2.2-py3-none-any.whl (163 kB)
#22 4.416      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 163.8/163.8 kB 23.2 MB/s eta 0:00:00
#22 4.458 Collecting xmltodict
#22 4.495   Downloading xmltodict-0.13.0-py2.py3-none-any.whl (10.0 kB)
#22 4.540 Collecting requests-ntlm>=1.1.0
#22 4.578   Downloading requests_ntlm-1.2.0-py3-none-any.whl (6.0 kB)
#22 4.584 Requirement already satisfied: six in /usr/local/lib/python3.11/site-packages (from pywinrm->-r /tmp/src/requirements.txt (line 5)) (1.16.0)
#22 4.592 Requirement already satisfied: cryptography>=1.3 in /usr/local/lib64/python3.11/site-packages (from requests-ntlm>=1.1.0->pywinrm->-r /tmp/src/requirements.txt (line 5)) (42.0.2)
#22 4.680 Collecting pyspnego>=0.1.6
#22 4.737   Downloading pyspnego-0.10.2-py3-none-any.whl (129 kB)
#22 4.745      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 129.9/129.9 kB 22.0 MB/s eta 0:00:00
#22 4.789 Requirement already satisfied: cffi>=1.12 in /usr/local/lib64/python3.11/site-packages (from cryptography>=1.3->requests-ntlm>=1.1.0->pywinrm->-r /tmp/src/requirements.txt (line 5)) (1.16.0)
#22 4.800 Requirement already satisfied: pycparser in /usr/local/lib/python3.11/site-packages (from cffi>=1.12->cryptography>=1.3->requests-ntlm>=1.1.0->pywinrm->-r /tmp/src/requirements.txt (line 5)) (2.21)
#22 4.960 Installing collected packages: pykerberos, objectpath, netaddr, xmltodict, wheel, urllib3, idna, charset-normalizer, certifi, requests, pyspnego, requests-ntlm, pywinrm
#22 4.961   DEPRECATION: pykerberos is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
#22 4.961   Running setup.py install for pykerberos: started
#22 5.231   Running setup.py install for pykerberos: finished with status 'error'
#22 5.236   error: subprocess-exited-with-error
#22 5.236
#22 5.236   Γ— Running setup.py install for pykerberos did not run successfully.
#22 5.236   β”‚ exit code: 1
#22 5.236   ╰─> [11 lines of output]
#22 5.236       running install
#22 5.236       /usr/local/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
#22 5.236         warnings.warn(
#22 5.236       running build
#22 5.236       running build_ext
#22 5.236       building 'kerberos' extension
#22 5.236       creating build
#22 5.236       creating build/temp.linux-x86_64-cpython-311
#22 5.236       creating build/temp.linux-x86_64-cpython-311/src
#22 5.236       gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python3.11 -c src/base64.c -o build/temp.linux-x86_64-cpython-311/src/base64.o
#22 5.236       error: command 'gcc' failed: No such file or directory
#22 5.236       [end of output]
#22 5.236
#22 5.236   note: This error originates from a subprocess, and is likely not a problem with pip.
#22 5.238 error: legacy-install-failure
#22 5.238
#22 5.238 Γ— Encountered error while trying to install package.
#22 5.238 ╰─> pykerberos
#22 5.238
#22 5.238 note: This is an issue with the package mentioned above, not pip.
#22 5.238 hint: See above for output from the failure.
#22 5.419
#22 5.419 [notice] A new release of pip available: 22.3.1 -> 24.0
#22 5.419 [notice] To update, run: python3.11 -m pip install --upgrade pip
#22 ERROR: process "/bin/sh -c /output/scripts/assemble" did not complete successfully: exit code: 1
------
 > [builder 6/6] RUN /output/scripts/assemble:
5.238 error: legacy-install-failure
5.238
5.238 Γ— Encountered error while trying to install package.
5.238 ╰─> pykerberos
5.238
5.238 note: This is an issue with the package mentioned above, not pip.
5.238 hint: See above for output from the failure.
5.419
5.419 [notice] A new release of pip available: 22.3.1 -> 24.0
5.419 [notice] To update, run: python3.11 -m pip install --upgrade pip
------
Dockerfile:65
--------------------
  63 |     COPY _build/requirements.txt requirements.txt
  64 |     RUN $PYCMD /output/scripts/introspect.py introspect --sanitize --user-pip=requirements.txt --write-bindep=/tmp/src/bindep.txt --write-pip=/tmp/src/requirements.txt
  65 | >>> RUN /output/scripts/assemble
  66 |
  67 |     # Final build stage
--------------------
ERROR: failed to solve: process "/bin/sh -c /output/scripts/assemble" did not complete successfully: exit code: 1

Hi, don’t worry, you’re on the right way :smiley:

From your Ansible Builder output, the line that should be noted is here:

#22 5.236       error: command 'gcc' failed: No such file or directory

Since the base image you’ve specified (quay.io/centos/centos:stream9-minimal) does not contain gcc, so Python has failed to build it, now it’s time to add gcc to dependencies.system :thinking:

However, if we continue on this way we’re on, I believe we will repeatedly solve one problem and then the next problem will appear. This is because stream9-minimal is really a minimal package installed, and there will probably be more things missing in the future.

So, I propose a slightly different approach. How about customizing based on a generic execution-environment.yml that is already working widely for AWX?

Specifically, how about customizing this file for use? This is the default EE image for AWX, which supports multiple connection methods, including Windows and network devices as well as Linux.

From our previous correspondence, I have read that your requirements are as follows

  • Requires collections: servicenow.itsm, community.general, community.network, ansible.windows
  • No warnings for ansible.windows
    • Ansible 2.14+
    • Python 3.9+ (it does not necessarily have to be 3.11)

As an example, based on the above file, I modified it to meet your requirements. Also added the comments why I modified so. It may include packages and modules that you don’t need, but I believe you will have less trouble.

---
version: 3

# Not modified: Keep base_image as-is since stream9 has basic packages including Python 3.9
images:
  base_image:
    name: quay.io/centos/centos:stream9

dependencies:

  # Not modified: Keep ansible_core as-is to install Ansible 2.15.x
  ansible_core:
    package_pip: ansible-core>=2.15.0rc2,<2.16

  # Not modified: Keep ansible_runner as-is to install latest ansible-runner
  ansible_runner:
    package_pip: ansible-runner

  # Modified: Commented unrequired collections out, added required collections
  galaxy: |
    ---
    collections:
      # - name: awx.awx
      # - name: azure.azcollection
      # - name: amazon.aws
      # - name: theforeman.foreman
      # - name: google.cloud
      # - name: openstack.cloud
      # - name: community.vmware
      # - name: ovirt.ovirt
      # - name: kubernetes.core
      - name: ansible.posix
      - name: ansible.windows
      # - name: redhatinsights.insights
      - name: servicenow.itsm
      - name: community.general
      - name: community.network

  # Modified: Commented unrequired packages that is not required for most use-cases
  system: |
    git-core [platform:rpm]
    python3.9-devel [platform:rpm compile]
    libcurl-devel [platform:rpm compile]
    krb5-devel [platform:rpm compile]
    krb5-workstation [platform:rpm]
    # subversion [platform:rpm]
    # subversion [platform:dpkg]
    git-lfs [platform:rpm]
    sshpass [platform:rpm]
    rsync [platform:rpm]
    epel-release [platform:rpm]
    python-unversioned-command [platform:rpm]
    unzip [platform:rpm]
    # podman-remote [platform:rpm]

  # Modified: Commented unrequired modules that is not required for most use-cases
  #           and added modules from your `requirements.txt`
  python: |
    git+https://github.com/ansible/ansible-sign
    ncclient
    paramiko
    pykerberos
    pyOpenSSL
    pypsrp[kerberos,credssp]
    pywinrm[kerberos,credssp]
    toml
    pexpect>=4.5
    python-daemon
    pyyaml
    six
    # receptorctl
    objectpath
    netaddr==0.10.1

additional_build_steps:

  # Not modified
  append_base:
    - RUN $PYCMD -m pip install -U pip

  # Modified: Comment receptor-related lines out since these are required only for control plane EE
  append_final:
    # - COPY --from=quay.io/ansible/receptor:devel /usr/bin/receptor /usr/bin/receptor
    # - RUN mkdir -p /var/run/receptor
    - RUN git lfs install --system
1 Like