Ansible with foreman plugin failing

We use a script to pull down the host variables from Forman with this command:
hammer --output yaml host enc-dump --name ${HOST}

That is then cleaned up and pushed into the vars.yaml file for that hostname. The problem happens when we run ansible with the plugin “foreman” enabled I see this:

Running playbook...
3629071 1687883906.72516: starting run
ansible-playbook [core 2.14.2]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.11/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible-playbook
  python version = 3.11.2 (main, Feb 18 2023, 08:12:16) [GCC 8.5.0 20210514 (Red Hat 8.5.0-18)] (/usr/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True
Using /etc/ansible/ansible.cfg as config file
[DEPRECATION WARNING]: DEFAULT_GATHER_SUBSET option, the module_defaults keyword is a more generic version and can apply to all calls to the M(ansible.builtin.gather_facts) or 
M(ansible.builtin.setup) actions, use module_defaults instead. This feature will be removed from ansible-core in version 2.18. Deprecation warnings can be disabled by setting 
deprecation_warnings=False in ansible.cfg.
3629071 1687883906.72823: Added group all to inventory
3629071 1687883906.72827: Added group ungrouped to inventory
3629071 1687883906.72831: Group all now contains ungrouped
3629071 1687883906.72834: Examining possible inventory source: /etc/ansible/hosts
3629071 1687883906.72954: trying /usr/share/ansible/plugins/cache
3629071 1687883906.72959: trying /usr/lib/python3.11/site-packages/ansible/plugins/cache
3629071 1687883906.73008: Loading CacheModule 'memory' from /usr/lib/python3.11/site-packages/ansible/plugins/cache/memory.py (searched paths: /usr/lib/python3.11/site-packages/ansible/plugins/cache:/usr/share/ansible/plugins/cache)
3629071 1687883906.73029: trying /usr/share/ansible/plugins/inventory
3629071 1687883906.73034: trying /usr/lib/python3.11/site-packages/ansible/plugins/inventory
3629071 1687883906.73082: Loading InventoryModule 'host_list' from /usr/lib/python3.11/site-packages/ansible/plugins/inventory/host_list.py (searched paths: /usr/share/ansible/plugins/inventory:/usr/lib/python3.11/site-packages/ansible/plugins/inventory)
3629071 1687883906.73132: Loaded config def from plugin (inventory/script)
3629071 1687883906.73136: Loading InventoryModule 'script' from /usr/lib/python3.11/site-packages/ansible/plugins/inventory/script.py (searched paths: /usr/share/ansible/plugins/inventory:/usr/lib/python3.11/site-packages/ansible/plugins/inventory)
3629071 1687883906.73169: Loading InventoryModule 'auto' from /usr/lib/python3.11/site-packages/ansible/plugins/inventory/auto.py (searched paths: /usr/share/ansible/plugins/inventory:/usr/lib/python3.11/site-packages/ansible/plugins/inventory)
3629071 1687883906.73233: Loaded config def from plugin (inventory/yaml)
3629071 1687883906.73237: Loading InventoryModule 'yaml' from /usr/lib/python3.11/site-packages/ansible/plugins/inventory/yaml.py (searched paths: /usr/share/ansible/plugins/inventory:/usr/lib/python3.11/site-packages/ansible/plugins/inventory)
3629071 1687883906.73299: Loading InventoryModule 'ini' from /usr/lib/python3.11/site-packages/ansible/plugins/inventory/ini.py (searched paths: /usr/share/ansible/plugins/inventory:/usr/lib/python3.11/site-packages/ansible/plugins/inventory)
3629071 1687883906.73555: Loading InventoryModule 'toml' from /usr/lib/python3.11/site-packages/ansible/plugins/inventory/toml.py (searched paths: /usr/share/ansible/plugins/inventory:/usr/lib/python3.11/site-packages/ansible/plugins/inventory)
3629071 1687883906.73567: trying /usr/lib/python3.11/site-packages/ansible/plugins/inventory/__pycache__
redirecting (type: inventory) ansible.builtin.foreman to theforeman.foreman.foreman
3629071 1687883906.74334: trying /usr/share/ansible/plugins/doc_fragments
3629071 1687883906.74340: trying /usr/lib/python3.11/site-packages/ansible/plugins/doc_fragments
3629071 1687883906.74380: Loading ModuleDocFragment 'inventory_cache' from /usr/lib/python3.11/site-packages/ansible/plugins/doc_fragments/inventory_cache.py (searched paths: /usr/share/ansible/plugins/doc_fragments:/usr/lib/python3.11/site-packages/ansible/plugins/doc_fragments)
3629071 1687883906.74485: Loading ModuleDocFragment 'constructed' from /usr/lib/python3.11/site-packages/ansible/plugins/doc_fragments/constructed.py (searched paths: /usr/share/ansible/plugins/doc_fragments:/usr/lib/python3.11/site-packages/ansible/plugins/doc_fragments)
3629071 1687883906.74558: Loaded config def from plugin (inventory/ansible_collections.theforeman.foreman.plugins.inventory.foreman)
3629071 1687883906.74562: Loading InventoryModule 'ansible_collections.theforeman.foreman.plugins.inventory.foreman' from /usr/share/ansible/collections/ansible_collections/theforeman/foreman/plugins/inventory/foreman.py (searched paths: /usr/share/ansible/plugins/inventory:/usr/lib/python3.11/site-packages/ansible/plugins/inventory:/usr/lib/python3.11/site-packages/ansible/plugins/inventory/__pycache__)
ERROR! This script requires python-requests 1.1 as a minimum version'
Done!

If I run a show requests I get the following:

[root@gp2us1opsfm01-main01a ~]# python3 -m pip show requests 
Name: requests
Version: 2.27.1
Summary: Python HTTP for Humans.
Home-page: https://requests.readthedocs.io
Author: Kenneth Reitz
Author-email: me@kennethreitz.org
License: Apache 2.0
Location: /usr/local/lib/python3.6/site-packages
Requires: idna, certifi, charset-normalizer, urllib3
[root@gp2us1opsfm01-main01a ~]# python -m pip show requests 
Name: requests
Version: 2.27.1
Summary: Python HTTP for Humans.
Home-page: https://requests.readthedocs.io
Author: Kenneth Reitz
Author-email: me@kennethreitz.org
License: Apache 2.0
Location: /usr/local/lib/python3.6/site-packages
Requires: idna, certifi, urllib3, charset-normalizer

The only way around this is to remove foreman enable_plugins in ansible.conf

Your Ansible is running with Python 3.11, but the pip output is from 3.6.

dnf install python311-requests and things should be working again.