Error getting started with Ansible on MacOS

Hello, I’m very new to Ansible.

I’m getting started with Ansible on my MacOS. I seen this issue on two different MacOS system so far.

This from -vvvv output

<x.x.x.x> ESTABLISH SSH CONNECTION FOR USER: username
<x.x.x.x> SSH: EXEC sshpass -d46 ssh -vvvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'User="username"' -o ConnectTimeout=10 -o 'ControlPath="/Users/username/.ansible/cp/607e7cafba"' x.x.x.x '/bin/sh -c '"'"'rm -f -r /home/username/.ansible/tmp/ansible-tmp-1729202032.6955981-98126-202028664109649/ > /dev/null 2>&1 && sleep 0'"'"''
<x.x.x.x> (0, b'', b"OpenSSH_9.8p1, LibreSSL 3.3.6\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug2: resolve_canonicalize: hostname x.x.x.x is address\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/Users/username/.ssh/known_hosts'\r\ndebug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/Users/username/.ssh/known_hosts2'\r\ndebug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling\r\ndebug1: auto-mux: Trying existing master at '/Users/username/.ansible/cp/607e7cafba'\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 98135\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet_timeout: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\n")

I can sucessfully ssh into the one node that I’m targeting.

The command I’m trying to run to validate ansible is working is just
ansible -m ping staging --ask-pass --ask-become-pass

This is the error without using -vvvv

host-staging | FAILED! => {
    "changed": false,
    "module_stderr": "Authorized uses only. All activity may be monitored and reported.\nTraceback (most recent call last):\n  File \"<stdin>\", line 107, in <module>\n  File \"<stdin>\", line 99, in _ansiballz_main\n  File \"<stdin>\", line 44, in invoke_module\n  File \"<frozen importlib._bootstrap>\", line 971, in _find_and_load\n  File \"<frozen importlib._bootstrap>\", line 951, in _find_and_load_unlocked\n  File \"<frozen importlib._bootstrap>\", line 894, in _find_spec\n  File \"<frozen importlib._bootstrap_external>\", line 1157, in find_spec\n  File \"<frozen importlib._bootstrap_external>\", line 1131, in _get_spec\n  File \"<frozen importlib._bootstrap_external>\", line 1112, in _legacy_get_spec\n  File \"<frozen importlib._bootstrap>\", line 441, in spec_from_loader\n  File \"<frozen importlib._bootstrap_external>\", line 544, in spec_from_file_location\n  File \"/tmp/ansible_ping_payload_xdqf2u_h/ansible_ping_payload.zip/ansible/module_utils/basic.py\", line 5\nSyntaxError: future feature annotations is not defined\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1

I’ve installed Ansible via HomeBrew and manually using pip commands and I keep seeing this message. Any assistance is appreciated. Thanks in advance.

The SyntaxError is from using too old of a Python version on the target host. ansible-core 2.17 requires at least Python 3.7 on the target host (see Releases and maintenance — Ansible Community Documentation).