Not able to execute command on FW using ansible due to SSH key auth error

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Please sign in to see details of an important advisory in our Customer Advisories area.

Not able to execute command on FW using ansible due to SSH key auth error

L0 Member

Advices are deeply appreciated, stuck in this issue for 2-3 days, please find below info.

 

Sample script###############

- name: running show system info cmd
hosts: PA
vars_files:
- pass.yml
roles:
- role: PaloAltoNetworks.paloaltonetworks
tasks:
- name: tasks will run now
panos_op:
#ip_address: '{{ ip_address }}'
# username: '{{ username }}'
password: '{{ password }}'
cmd: 'show system info'

 

Ansible.cfg output######################

inventory=./hosts
roles_path=./roles
interpreter_python=/home/user/venv/bin/python
#[ssh_connection]
#ssh_args = -o ControlMaster=no
#host_key_checking = False

 

Hosts file output########

[PA]

10.x.x.x   ansible_connection=ssh ansible_user=user

 

debug output -vvv and error#########

 


TASK [Gathering Facts] **********************************************************************************************************************************************************************************************
task path: /home/user/file.yml:1
<10.x.x.x> ESTABLISH SSH CONNECTION FOR USER: user
<10.x.x.x> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="user"' -o ConnectTimeout=10 -o ControlPath=/home/user/.ansible/cp/7935e2xxx 10.x.x.x '/bin/sh -c '"'"'echo ~user && sleep 0'"'"''
<10.x.x.x> (255, b'', b'This system is the property of xyz. Unauthorized use may result in penalties including, but not limited to, reprimand, dismissal, financial penalties, and legal action.\nuser@10.x.x.x: Permission denied (publickey,password,keyboard-interactive).\r\n')
fatal: [10.206.30.36]: UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: This system is the property of xyz. Unauthorized use may result in penalties including, but not limited to, reprimand, dismissal, financial penalties, and legal action.\nuser@10.x.x.x: Permission denied (publickey,password,keyboard-interactive).",
"unreachable": true

1 REPLY 1

L5 Sessionator

I suspect your connection is not set to "local" at the top of your playbook...?  Because panos_op doesn't connect using ssh.

  • 3138 Views
  • 1 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!