0

First time running Ansible. I am not sure what I am doing wrong but i cant seem to Google my way out of this error. Very basic script asking to run show version on a Cisco IOS Switch. but it doesnt seem like the playbook is ever getting to even the SSH point.

---
- name: Run show version command on Cisco IOS switch
  hosts: switches
  gather_facts: no
  connection: network_cli

  tasks:
    - name: Run show version command
      ios_command:
        commands:
          - show version
      register: version_output

    - name: Display version output
      debug:
        var: version_output.stdout_lines

TASK [Run show version command] ***************************************************************************************************************************************************************** fatal: [10.16.100.6]: FAILED! => {"changed": false, "msg": "socket path /home/user/.ansible/pc/213a4a4412 does not exist or cannot be found. See Troubleshooting socket path issues in the Network Debug and Troubleshooting Guide"}

I have tried running show commands, I have tried changing the hostname but no matter what I always get the same error. I am pretty sure (not a linux expert) I set CHMOD to 777 for the "/home/user/.ansible/pc" folder.

  tasks:
    - name: configure hostname
      ios_config:
       lines: 
        - hostname Home-Switch-Ansible
    
  • Adding Sudo in front of running the ansible-playbook "fixed" this. Any idea how i make it so i dont have to use Sudo? – Sky Blue Why Jun 19 '23 at 19:23

0 Answers0