Problem Description: I want to run healthcheck commands on a VSX based checkpoint R80.10 23500 model and 5500 normal checkpoint firewall gateway but i am unable to login into the firewall.
There are 2 simple playbooks i am mentioning here, 1 by using ansible roles (name = cp1.yml) and other is direct access (cp2.yml).
In LAB environment i am getting results for cp1.yml but cp2.yml is failing saying it needs ansible_network_os value. (Want to know what would be the ansible_network_os for checkpoint)
In production, none of these 2 are working and i am getting below error:
When login through network_cli then below error is coming while executing both playbooks:
-bash-4.2$ ansible-playbook cp2.yml
PLAY [CheckPoint health Status] *************************************************************************************************************************************************************************************************************
TASK [checkpoint healthcheck commands] ******************************************************************************************************************************************************************************************************
fatal: [firewall]: FAILED! => {"msg": "unable to set terminal parameters"}
****************************************************************
My Playbooks: (Playbook 1) cp1.yml
in /etc/ansible directory:
---
- name: CheckPoint health Status
hosts: checkpoint
gather_facts: no
serial: 1
tasks:
- name: checkpoint healthcheck commands
import_role:
name: trib_role
tasks_from: showbash
vars:
cmdfile: show-bash.cmd
************
-bash-4.2$ cat show-bash.cmd
fw ver
fw tab -t connections -s
-bash-4.2$
*****************
-bash-4.2$ pwd
/etc/ansible/roles/trib_role/tasks <-------------Roles directory
******************
-bash-4.2$ cat showbash.yml
---
- name: SHOW CONFIG
cli_command:
command: "{{ item }}"
with_lines: cat {{ cmdfile }}
register: result1
- name: show output files
debug:
var: result1
host file:
[checkpoint]
firewall <---------------------My production firewall name
-bash-4.2$ cd host_vars/
-bash-4.2$ cat firewall
---
ansible_host: x.x.x.x (My production firewall IP)
ansible_user: admin
ansible_ssh_pass: ********* (admin password)
ansible_connection: network_cli
**********************************************************
Playbook2 cp2.yml:
---
- name: CheckPoint health Status
hosts: checkpoint
gather_facts: no
serial: 1
tasks:
- name: checkpoint healthcheck commands
cli_command:
command:
- 'fw ver'
register: result
- name: show output
debug:
var: result.stdout_lines
-bash-4.2$
Here also getting the same error:
-bash-4.2$ ansible-playbook cp2.yml -vvvvPLAYBOOK: cp2.yml ***************************************************************************************************************************************************************************************************************************1 plays in cp2.ymlPLAY [CheckPoint health Status] *************************************************************************************************************************************************************************************************************META: ran handlersTASK [checkpoint healthcheck commands] ******************************************************************************************************************************************************************************************************task path: /etc/ansible/cp2.yml:8<x.x.x.x> attempting to start connection<x.x.x.x> using connection plugin network_cli<x.x.x.x> local domain socket does not exist, starting it<x.x.x.x> control socket path is /files0/home/singhtr/.ansible/pc/22a0ffc2f6<x.x.x.x>The full traceback is:Traceback (most recent call last): File "/usr/bin/ansible-connection", line 106, in start self.connection._connect() File "/usr/lib/python2.7/site-packages/ansible/plugins/connection/network_cli.py", line 334, in _connect self._terminal.on_open_shell() File "/usr/lib/python2.7/site-packages/ansible/plugins/terminal/ios.py", line 58, in on_open_shell raise AnsibleConnectionFailure('unable to set terminal parameters')AnsibleConnectionFailure: unable to set terminal parametersfatal: [firewall]: FAILED! => { "msg": "unable to set terminal parameters"} to retry, use: --limit @/etc/ansible/cp2.retryPLAY RECAP **********************************************************************************************************************************************************************************************************************************firewall : ok=0 changed=0 unreachable=0 failed=1