# Ansible Core 2.18 fails on remote host with Python 3.6 — future feature annotations is not defined during fact gathering

**URL:** <https://forum.ansible.com/t/ansible-core-2-18-fails-on-remote-host-with-python-3-6-future-feature-annotations-is-not-defined-during-fact-gathering/44802>\
**Category:** Get Help\
**Tags:** rhel, python, facts, ubuntu, linux, ansible-core\
**Created:** [November 6, 2025, 2:47pm UTC](https://forum.ansible.com/t/ansible-core-2-18-fails-on-remote-host-with-python-3-6-future-feature-annotations-is-not-defined-during-fact-gathering/44802 "2025-11-06T14:47:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![harshit.sheth](https://avatars.discourse-cdn.com/v4/letter/h/858c86/32.png) [@harshit.sheth](https://forum.ansible.com/u/harshit.sheth)\
**Post date:** [November 6, 2025, 2:47pm UTC](https://forum.ansible.com/t/ansible-core-2-18-fails-on-remote-host-with-python-3-6-future-feature-annotations-is-not-defined-during-fact-gathering/44802/1 "2025-11-06T14:47:37Z")

</div>

Hello Team,

I’m encountering a blocking issue with **Ansible Core 2.18.10** when running playbooks on remote hosts that only have **Python 3.6.8** installed. The error occurs during the `Gathering Facts` phase and prevents the playbook from progressing.

* * *

### ✅ Environment Details

- **Control Node** :
  - Ansible version: `ansible [core 2.18.10]`
  - Python version: `3.12.12`
  - OS: Linux (running via Semaphore)

- **Remote Host** :
  - OS: RHEL / Ubuntu based VM
  - Python version: `3.6.8` (located at `/usr/bin/python3`)

- **Inventory Configuration** :

```ini
[all:vars]
ansible_connection=ssh
ansible_ssh_common_args="-o StrictHostKeyChecking=no"
ansible_python_interpreter=/usr/bin/python3

```

* * *

### 🧩 Error Output

```auto
TASK [Gathering Facts] *********************************************************
fatal: [REDHAT_VM1]: FAILED! => changed=false 
  ansible_facts: {}
  failed_modules:
    ansible.legacy.setup:
      exception: |- SyntaxError: future feature annotations is not defined
      failed: true
      module_stderr: |- Shared connection to 10.21.100.99 closed.
      module_stdout: |- Traceback (most recent call last):
        ...
        SyntaxError: future feature annotations is not defined
      msg: |-
        MODULE FAILURE: No start of json char found
        See stdout/stderr for the exact error
      rc: 1
  msg: |-
    The following modules failed to execute: ansible.legacy.setup

```

* * *

### 📦 Playbook Overview

My playbook includes multiple roles and tasks that depend on facts:

```yaml
- name: Common configuration - ping + hostname entry + repo update + packages + RHEL Subscription
  hosts: all
  become_user: root
  become: true
  gather_facts: true
  roles:
    - common-bootstart
...
- name: Active Directory AD-join + Sudoers + SNMP + SSSD
- name: Linux hardening
- name: Linux Firewall
- name: Software installation 

```

These roles rely on facts like:

- `ansible_os_family`, `ansible_distribution`, `ansible_pkg_mgr` for conditional logic (RedHat vs Ubuntu)
- `ansible_hostname`, `ansible_default_ipv4.address` for updating `/etc/hosts`

* * *

### 🚫 Constraints

- I **cannot upgrade Python** on the remote hosts due to environment restrictions.
- I need `gather_facts: true` because many roles depend on system facts for conditional logic and configuration.

* * *

### ❓ What I Need Help With

- Is there a way to **force Ansible 2.18 to use Python 3.6-compatible modules**?
- Can I configure Ansible to **avoid using ` __future__.annotations`** in remote execution?
- Are there **collections or module versions** that still support Python 3.6?
- Any known workarounds to **enable fact gathering or simulate it** without upgrading Python?

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [November 6, 2025, 3:05pm UTC](https://forum.ansible.com/t/ansible-core-2-18-fails-on-remote-host-with-python-3-6-future-feature-annotations-is-not-defined-during-fact-gathering/44802/2 "2025-11-06T15:05:38Z")

</div>

ansible-core 2.17 dropped support for Python 3.6. To automate against python3.6 will require using ansible-core 2.16.

---

<div class="post-metadata">

**Author:** ![harshit.sheth](https://avatars.discourse-cdn.com/v4/letter/h/858c86/32.png) [@harshit.sheth](https://forum.ansible.com/u/harshit.sheth)\
**Post date:** [November 10, 2025, 4:16pm UTC](https://forum.ansible.com/t/ansible-core-2-18-fails-on-remote-host-with-python-3-6-future-feature-annotations-is-not-defined-during-fact-gathering/44802/3 "2025-11-10T16:16:43Z")

</div>

Thank you Sivel, it is working with ansible-2.16.5.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [December 10, 2025, 4:17pm UTC](https://forum.ansible.com/t/ansible-core-2-18-fails-on-remote-host-with-python-3-6-future-feature-annotations-is-not-defined-during-fact-gathering/44802/4 "2025-12-10T16:17:16Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
