<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Ansible Connection Error in Ansible</title>
    <link>https://community.checkpoint.com/t5/Ansible/Ansible-Connection-Error/m-p/101410#M403</link>
    <description>&lt;P&gt;Thank you so much for helping me. This worked.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for checking this issue with Red Hat &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 08 Nov 2020 10:08:55 GMT</pubDate>
    <dc:creator>mervin16</dc:creator>
    <dc:date>2020-11-08T10:08:55Z</dc:date>
    <item>
      <title>Ansible Connection Error</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-Connection-Error/m-p/101372#M395</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a network in my Checkpoint SMS R80.40 using Ansible but i am getting a Connection Error.&lt;/P&gt;&lt;P&gt;The full error is:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.module_utils.connection.ConnectionError: Server returned response without token info during connection authentication: 500
fatal: [ckp_sms_ngen]: FAILED! =&amp;gt; {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-local-304lwzdpy_j/ansible-tmp-1604762020.3755455-406-100633197970042/AnsiballZ_cp_mgmt_network.py\", line 102, in &amp;lt;module&amp;gt;\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-local-304lwzdpy_j/ansible-tmp-1604762020.3755455-406-100633197970042/AnsiballZ_cp_mgmt_network.py\", line 94, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-local-304lwzdpy_j/ansible-tmp-1604762020.3755455-406-100633197970042/AnsiballZ_cp_mgmt_network.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.check_point.mgmt.plugins.modules.cp_mgmt_network', init_globals=None, run_name='__main__', alter_sys=True)\n  File \"/usr/lib/python2.7/runpy.py\", line 188, in run_module\n    fname, loader, pkg_name)\n  File \"/usr/lib/python2.7/runpy.py\", line 82, in _run_module_code\n    mod_name, mod_fname, mod_loader, pkg_name)\n  File \"/usr/lib/python2.7/runpy.py\", line 72, in _run_code\n    exec code in run_globals\n  File \"/tmp/ansible_check_point.mgmt.cp_mgmt_network_payload_EPDDSc/ansible_check_point.mgmt.cp_mgmt_network_payload.zip/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_network.py\", line 225, in &amp;lt;module&amp;gt;\n  File \"/tmp/ansible_check_point.mgmt.cp_mgmt_network_payload_EPDDSc/ansible_check_point.mgmt.cp_mgmt_network_payload.zip/ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_network.py\", line 220, in main\n  File \"/tmp/ansible_check_point.mgmt.cp_mgmt_network_payload_EPDDSc/ansible_check_point.mgmt.cp_mgmt_network_payload.zip/ansible_collections/check_point/mgmt/plugins/module_utils/checkpoint.py\", line 265, in api_call\n  File \"/tmp/ansible_check_point.mgmt.cp_mgmt_network_payload_EPDDSc/ansible_check_point.mgmt.cp_mgmt_network_payload.zip/ansible_collections/check_point/mgmt/plugins/module_utils/checkpoint.py\", line 65, in send_request\n  File \"/tmp/ansible_check_point.mgmt.cp_mgmt_network_payload_EPDDSc/ansible_check_point.mgmt.cp_mgmt_network_payload.zip/ansible/module_utils/connection.py\", line 195, in __rpc__\nansible.module_utils.connection.ConnectionError: Server returned response without token info during connection authentication: 500\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Playbook is as such:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;---
- name: playbook name
  hosts: firewalls_checkpoint
  connection: httpapi
  tasks:
    - name: task to have network
      check_point.mgmt.cp_mgmt_network:
        name: "network name"
        subnet: "4.1.76.0"
        mask_length: 24
        auto_publish_session: true

      vars:
        ansible_checkpoint_domain: "SMC User"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Hosts file:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#This is a group of remote servers for Checkpoint SMS
[firewalls_checkpoint]
ckp_sms_ngen

#These are global variables for the group firewalls
[firewalls_checkpoint:vars]
ansible_user=admin
ansible_password=*****
ansible_network_os=check_point.mgmt.checkpoint
ansible_httpapi_use_ssl=yes
ansible_httpapi_validate_certs=no
ansible_python_interpreter=/usr/bin/python2.7&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The checkpoint version i am using is:&lt;/P&gt;&lt;P&gt;This is Check Point Security Management Server R80.40 - Build 150&lt;BR /&gt;This is Check Point's software version R80.40 - Build 685&lt;/P&gt;&lt;P&gt;I tried sending requests via POSTMAN and it works fine.&lt;/P&gt;&lt;P&gt;Can someone please help me ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Nov 2020 15:19:02 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-Connection-Error/m-p/101372#M395</guid>
      <dc:creator>mervin16</dc:creator>
      <dc:date>2020-11-07T15:19:02Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible Connection Error</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-Connection-Error/m-p/101387#M400</link>
      <description>&lt;P&gt;Hi Mervin,&lt;/P&gt;
&lt;P&gt;What I assume is that you have mapped ckp_sms_ngen to an ip address in /etc/hosts. &lt;BR /&gt;I noticed that when doing so this causes Ansible httpapi connection plugin to send "X-Forwarded-Host=[]" in the http header, which in turn causes the server to respond with:&lt;/P&gt;
&lt;P&gt;Response-Code: 400&lt;BR /&gt;Content-Type: application/json&lt;BR /&gt;Headers: {Content-Type=[application/json], Date=[Sat, 07 Nov 2020 21:00:13 GMT]}&lt;BR /&gt;Payload: {&lt;BR /&gt;"code" : "generic_err_missing_required_header",&lt;BR /&gt;"message" : "Invalid header: [X-Forwarded-Host]"&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;While Ansible should send X-Forwarded-Host=[X.X.X.X:443],&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can work around this by adding "ansible_host" to your /etc/ansibe/hosts file.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;[firewalls_checkpoint]
ckp_sms_ngen ansible_host=192.168.233.71&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not sure if the problem is on the Ansible core side or our collection, but I will report this to our developers so they can work with Red Hat on that.&lt;/P&gt;
&lt;P&gt;Kind Regards&lt;BR /&gt;Jim&lt;/P&gt;</description>
      <pubDate>Sat, 07 Nov 2020 21:20:47 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-Connection-Error/m-p/101387#M400</guid>
      <dc:creator>Jim_Oqvist</dc:creator>
      <dc:date>2020-11-07T21:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible Connection Error</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-Connection-Error/m-p/101410#M403</link>
      <description>&lt;P&gt;Thank you so much for helping me. This worked.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for checking this issue with Red Hat &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Nov 2020 10:08:55 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-Connection-Error/m-p/101410#M403</guid>
      <dc:creator>mervin16</dc:creator>
      <dc:date>2020-11-08T10:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible Connection Error</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-Connection-Error/m-p/101483#M406</link>
      <description>&lt;P&gt;To update, this only seems to happen when using underscore "_" in the hostname, when using dash "-" will work fine.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;PLAY RECAP *************************************************************************************************
chkp-mgmt                  : ok=1    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
chkp_sms                   : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 09 Nov 2020 10:44:49 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-Connection-Error/m-p/101483#M406</guid>
      <dc:creator>Jim_Oqvist</dc:creator>
      <dc:date>2020-11-09T10:44:49Z</dc:date>
    </item>
  </channel>
</rss>

