- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
09-27-2021 03:40 PM - edited 09-27-2021 03:41 PM
Hi there, I have a super basic Ansible script that is meant to just change the admin password using SSH.
---
- name: change admin password for newly deployed Palo Alto firewall
hosts: firewall
collections:
- paloaltonetworks.panos
gather_facts: no
tasks:
- name: Change admin password using SSH
panos_admpwd:
ip_address: '{{ provider.ip_address }}'
newpassword: '{{ provider.new_password }}'
key_filename: '{{ ansible_ssh_private_key_file }}'
register: result
until: not result|failed
retries: 10
delay: 30
- name: panos commit
panos_commit_firewall:
provider: '{{ provider }}'
and for whatever reason, the task just hangs when establishing the connection.
TASK [Change admin password using SSH] **************************************************************************************************************************************************************************************************************************************************************************************************************************
task path: /home/dapper/Morannon/Ansible/morannon.yml:9
<xx.xxx.xx.xxx> ESTABLISH SSH CONNECTION FOR USER: admin
<xx.xxx.xx.xxx> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o 'IdentityFile="ssh.key"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="admin"' -o ConnectTimeout=10 -o ControlPath=/home/dapper/.ansible/cp/52255bf5c1 xxx.xxx.xx.xxx '/bin/sh -c '"'"'echo ~admin && sleep 0'"'"''
I did find an issue on the GitHub where this exact thing was happening, but it was supposedly fixed.
This is my ansible version:
ansible [core 2.11.5]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/dapper/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/dapper/.local/lib/python3.8/site-packages/ansible
ansible collection location = /home/dapper/.ansible/collections:/usr/share/ansible/collections
executable location = /home/dapper/.local/bin/ansible
python version = 3.8.0 (default, Feb 25 2021, 22:10:10) [GCC 8.4.0]
jinja version = 3.0.1
libyaml = True
10-02-2021 04:02 AM
Per the reply from MR on https://github.com/PaloAltoNetworks/pan-os-ansible/discussions/272, connection should be local. There is a repo of example playbooks here that might be useful for you: https://github.com/PaloAltoNetworks/ansible-playbooks
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!