Can't run Ansible directly from Mac OS, only Linux VM

Hello,

I can run Ansible playbooks from my Mac as long as I do it from a Linux VM. I cannot run the same playbook directly from Mac OS.

Below is the output (with verbose) when attempting to run a playbook from MacOS to access a Cisco IOS router. It is a very simple example.


Background

Works from Linux: 
- The same playbook and hosts file works when I use a Ubuntu Linux VM to the same Cisco router.
- The same ssh_config file on both Linux VM and MacOS

From my Mac: 
- I can SSH into the Cisco router.
- I can run Netmiko, NAPALM and NORNIR via SSH and successfully execute Python code to the Cisco router
- I can use ansible to successfully ping (pong) the cisco router (ansible -i hosts cisco_routers -m ping -vvv)

Versions

ansible [core 2.17.1]
MacOS Sonoma 14.5
Processor Intel


Problem: 

I can't run the same playbook directly from my Mac.

Ansible % ansible-playbook -i hosts display_ipv4_addresses.yaml -vvv
ansible-playbook [core 2.17.1]
  config file = None
  configured module search path = ['/Users/tester/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/ansible
  ansible collection location = /Users/tester/.ansible/collections:/usr/share/ansible/collections
  executable location = /Library/Frameworks/Python.framework/Versions/3.10/bin/ansible-playbook
  python version = 3.10.3 (v3.10.3:a342a49189, Mar 16 2022, 09:34:18) [Clang 13.0.0 (clang-1300.0.29.30)] (/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10)
  jinja version = 3.1.2
  libyaml = True
No config file found; using defaults
host_list declined parsing /Users/tester/Desktop/cisco/Ansible Update/Ansible/hosts as it did not pass its verify_file() method
script declined parsing /Users/tester/Desktop/cisco/Ansible Update/Ansible/hosts as it did not pass its verify_file() method
auto declined parsing /Users/tester/Desktop/cisco/Ansible Update/Ansible/hosts as it did not pass its verify_file() method
Parsed /Users/tester/Desktop/cisco/Ansible Update/Ansible/hosts inventory source with ini plugin
redirecting (type: modules) ansible.builtin.ios_command to cisco.ios.ios_command
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: display_ipv4_addresses.yaml **************************************************************************************************
1 plays in display_ipv4_addresses.yaml

PLAY [Show IP Interface Brief on Cisco IOS routers] ************************************************************************************

TASK [Run 'show ip interface brief' command] *******************************************************************************************
task path: /Users/tester/Desktop/cisco/Ansible Update/Ansible/display_ipv4_addresses.yaml:6
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
redirecting (type: become) ansible.builtin.enable to ansible.netcommon.enable
redirecting (type: modules) ansible.builtin.ios_command to cisco.ios.ios_command
redirecting (type: action) ansible.builtin.ios to cisco.ios.ios
redirecting (type: action) ansible.builtin.ios to cisco.ios.ios
redirecting (type: action) ansible.builtin.ios to cisco.ios.ios
redirecting (type: modules) ansible.builtin.ios_command to cisco.ios.ios_command
The full traceback is:
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/ansible_collections/cisco/ios/plugins/module_utils/network/ios/ios.py", line 60, in get_capabilities
    capabilities = Connection(module._socket_path).get_capabilities()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/ansible/module_utils/connection.py", line 199, in __rpc__
    raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)
fatal: [ansible_host=192.168.3.2]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "commands": [
                "show ip interface brief"
            ],
            "interval": 1,
            "match": "all",
            "retries": 9,
            "wait_for": null
        }
    },
    "msg": "[Errno 8] nodename nor servname provided, or not known"
}

PLAY RECAP *****************************************************************************************************************************
ansible_host=192.168.3.2   : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   

My files

hosts

[cisco_routers]
192.168.3.2 ansible_connection=network_cli ansible_network_cli_ssh_type=paramiko ansible_network_os=cisco.ios.ios ansible_user=admin ansible_password=cisco ansible_become=yes ansible_become_method=enable ansible_become_password=class

Playbook: display__ipv4:addresses.yaml


  • name: Show IP Interface Brief on Cisco IOS routers
    hosts: cisco_routers
    gather_facts: no
    tasks:
    • name: Run ‘show ip interface brief’ command
      ios_command:
      commands:
      - show ip interface brief
      register: output

    • name: Display command output
      debug:
      var: output.stdout


Any help would be greatly appreciated!