<?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 Obtain objects from CMA managed by MDS with Ansible in Ansible</title>
    <link>https://community.checkpoint.com/t5/Ansible/Obtain-objects-from-CMA-managed-by-MDS-with-Ansible/m-p/192757#M748</link>
    <description>&lt;P&gt;Hello Mates,&lt;BR /&gt;&lt;BR /&gt;I have been working with CheckPoint and Ansible for the past 6/7 months.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;My environment has been a Smart 1 appliance where I have different instances (VSX, Gateways, etc) and I could manage objects, policies, layers and more from a centralized point without any major inconvenience. So I was working with an independent CMA.&lt;/P&gt;&lt;P&gt;Now, I have access to a MDS with several CMAs, I'm trying to execute some changes in a CMA like before but for my surprise it isn't working. I can access to the CMAs (directly or trough MDS) using SmartConsole R81.10, visualize the different objects and policies existing, but when I try to gather some information using the playbooks I used to, the obtained JSON objects are empty.&lt;/P&gt;&lt;P&gt;The playbooks I'm currently testing are very simple, here is an example:&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;---&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;- name: Obtain host objects&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;&amp;nbsp; &amp;nbsp;gather_facts: false&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;&amp;nbsp; &amp;nbsp;hosts: CMA-1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;&amp;nbsp; &amp;nbsp;connection: ansible.netcommon.httpapi&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;&amp;nbsp; &amp;nbsp;tasks:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;# Obtain the first 100 objects&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; - name: Get host objects&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;register: cp_hosts&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;check_point.mgmt.cp_mgmt_host_facts:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; details_level: standard&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; limit: 100&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; offset: 0&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;The answer:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;TASK [Get host objects] *******************&lt;/STRONG&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;ok: [CMA-1] =&amp;gt; {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp;"ansible_facts": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; "hosts": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"objects": [],&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"total": 0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp;},&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp;"changed": false,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp;"invocation": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; "module_args": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"details_level": "standard",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"limit": 100,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"name": null,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"offset": 0,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"order": null,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"show_membership": null,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"version": null&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;In other cases, when gathering information related to MDS, for example the existing domains (using module check_point.mgmt.cp_mgmt_domain_facts), I &lt;STRONG&gt;do&lt;/STRONG&gt; obtain the information, even when I ask to the CMA instead of MDS, which I don't fully understand but is not the case.&lt;/P&gt;&lt;P&gt;I have used MDS and CMA-1 as hosts parameters, but no one returns whatever information I have asked for.&lt;/P&gt;&lt;P&gt;What I am doing wrong? Am I asking the correct host? Do I have to include some missing parameter?&lt;/P&gt;&lt;P&gt;I have been reading the documentation but didn't find any answer.&amp;nbsp;&lt;A href="https://docs.ansible.com/ansible/latest/collections/check_point/mgmt/index.html" target="_blank"&gt;https://docs.ansible.com/ansible/latest/collections/check_point/mgmt/index.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Sep 2023 12:02:37 GMT</pubDate>
    <dc:creator>E_AGH107</dc:creator>
    <dc:date>2023-09-15T12:02:37Z</dc:date>
    <item>
      <title>Obtain objects from CMA managed by MDS with Ansible</title>
      <link>https://community.checkpoint.com/t5/Ansible/Obtain-objects-from-CMA-managed-by-MDS-with-Ansible/m-p/192757#M748</link>
      <description>&lt;P&gt;Hello Mates,&lt;BR /&gt;&lt;BR /&gt;I have been working with CheckPoint and Ansible for the past 6/7 months.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;My environment has been a Smart 1 appliance where I have different instances (VSX, Gateways, etc) and I could manage objects, policies, layers and more from a centralized point without any major inconvenience. So I was working with an independent CMA.&lt;/P&gt;&lt;P&gt;Now, I have access to a MDS with several CMAs, I'm trying to execute some changes in a CMA like before but for my surprise it isn't working. I can access to the CMAs (directly or trough MDS) using SmartConsole R81.10, visualize the different objects and policies existing, but when I try to gather some information using the playbooks I used to, the obtained JSON objects are empty.&lt;/P&gt;&lt;P&gt;The playbooks I'm currently testing are very simple, here is an example:&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;---&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;- name: Obtain host objects&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;&amp;nbsp; &amp;nbsp;gather_facts: false&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;&amp;nbsp; &amp;nbsp;hosts: CMA-1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;&amp;nbsp; &amp;nbsp;connection: ansible.netcommon.httpapi&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;&amp;nbsp; &amp;nbsp;tasks:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;# Obtain the first 100 objects&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; - name: Get host objects&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;register: cp_hosts&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;check_point.mgmt.cp_mgmt_host_facts:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; details_level: standard&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; limit: 100&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; offset: 0&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;The answer:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;TASK [Get host objects] *******************&lt;/STRONG&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;ok: [CMA-1] =&amp;gt; {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp;"ansible_facts": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; "hosts": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"objects": [],&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"total": 0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp;},&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp;"changed": false,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp;"invocation": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; "module_args": {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"details_level": "standard",&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"limit": 100,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"name": null,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"offset": 0,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"order": null,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"show_membership": null,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;"version": null&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;&amp;nbsp; &amp;nbsp;}&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial,helvetica,sans-serif" color="#339966"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;In other cases, when gathering information related to MDS, for example the existing domains (using module check_point.mgmt.cp_mgmt_domain_facts), I &lt;STRONG&gt;do&lt;/STRONG&gt; obtain the information, even when I ask to the CMA instead of MDS, which I don't fully understand but is not the case.&lt;/P&gt;&lt;P&gt;I have used MDS and CMA-1 as hosts parameters, but no one returns whatever information I have asked for.&lt;/P&gt;&lt;P&gt;What I am doing wrong? Am I asking the correct host? Do I have to include some missing parameter?&lt;/P&gt;&lt;P&gt;I have been reading the documentation but didn't find any answer.&amp;nbsp;&lt;A href="https://docs.ansible.com/ansible/latest/collections/check_point/mgmt/index.html" target="_blank"&gt;https://docs.ansible.com/ansible/latest/collections/check_point/mgmt/index.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2023 12:02:37 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Obtain-objects-from-CMA-managed-by-MDS-with-Ansible/m-p/192757#M748</guid>
      <dc:creator>E_AGH107</dc:creator>
      <dc:date>2023-09-15T12:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: Obtain objects from CMA managed by MDS with Ansible</title>
      <link>https://community.checkpoint.com/t5/Ansible/Obtain-objects-from-CMA-managed-by-MDS-with-Ansible/m-p/192761#M749</link>
      <description>&lt;P&gt;It sounds like you're connecting to the MDS domain, rather than the specific CMA-1 Domain.&lt;/P&gt;
&lt;P&gt;Your ansible host/target should be the primary MDS. Then in&amp;nbsp;the playbook, make sure to add a variable with your target domain with the ansible_checkpoint_domain variable. In my example below, my domain name is Domain1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;---
- name: "Show Hosts in the Domain"
  gather_facts: no
  hosts: mds-primary
  vars:
     ansible_connection: httpapi
     ansible_httpapi_use_ssl: True
     ansible_httpapi_validate_certs: False
     ansible_network_os: check_point.mgmt.checkpoint
     ansible_checkpoint_domain: Domain1

  tasks:
    - name: show-checkpoint-hosts
      cp_mgmt_host_facts:
        limit: 100
      register: show_hosts

    - debug:
        msg: "{{ show_hosts }}"
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2023 13:18:35 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Obtain-objects-from-CMA-managed-by-MDS-with-Ansible/m-p/192761#M749</guid>
      <dc:creator>Erik_Lagzdins</dc:creator>
      <dc:date>2023-09-15T13:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: Obtain objects from CMA managed by MDS with Ansible</title>
      <link>https://community.checkpoint.com/t5/Ansible/Obtain-objects-from-CMA-managed-by-MDS-with-Ansible/m-p/192767#M750</link>
      <description>&lt;P&gt;Indeed, that was the missing parameter!&lt;BR /&gt;&lt;BR /&gt;I added the parameter in the host_vars file of CMA-1 so can re-use playbook.&lt;BR /&gt;&lt;BR /&gt;Thank you so much Erik!&lt;/P&gt;</description>
      <pubDate>Fri, 15 Sep 2023 14:07:15 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Obtain-objects-from-CMA-managed-by-MDS-with-Ansible/m-p/192767#M750</guid>
      <dc:creator>E_AGH107</dc:creator>
      <dc:date>2023-09-15T14:07:15Z</dc:date>
    </item>
  </channel>
</rss>

