<?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 - getting info from multiple domains from provider in Ansible</title>
    <link>https://community.checkpoint.com/t5/Ansible/Ansible-getting-info-from-multiple-domains-from-provider/m-p/83141#M296</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Normally you would run your playbook in a MDM scenario against your mgmt-ip and the domain will be a variable.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;- name: Check vpn's on Check Point platform
connection: httpapi
hosts: MGMT-IP
gather_facts: no
vars: 
  ansible_checkpoint_domain: "Domain 1"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;It think you have to use the&amp;nbsp; module cp_mgmt_mds_facts to get all domains and create a list of domains to loop your task through all domains (&lt;A href="https://docs.ansible.com/ansible/latest/modules/cp_mgmt_mds_facts_module.html#cp-mgmt-mds-facts-module" target="_blank"&gt;https://docs.ansible.com/ansible/latest/modules/cp_mgmt_mds_facts_module.html#cp-mgmt-mds-facts-module&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 25 Apr 2020 10:59:14 GMT</pubDate>
    <dc:creator>IdentityUnknown</dc:creator>
    <dc:date>2020-04-25T10:59:14Z</dc:date>
    <item>
      <title>Ansible - getting info from multiple domains from provider</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-getting-info-from-multiple-domains-from-provider/m-p/82095#M281</link>
      <description>&lt;DIV class="lia-quilt-row lia-quilt-row-message-subject"&gt;&lt;DIV class="lia-quilt-column lia-quilt-column-24 lia-quilt-column-single lia-quilt-column-message-subject-content"&gt;&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-single"&gt;&lt;DIV class="topic-subject-wrapper"&gt;&lt;DIV class="lia-message-subject lia-component-message-view-widget-subject"&gt;&lt;DIV class="MessageSubject"&gt;&lt;DIV class="MessageSubjectIcons "&gt;&lt;DIV class="lia-message-subject"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="lia-quilt-row lia-quilt-row-message-body"&gt;&lt;DIV class="lia-quilt-column lia-quilt-column-24 lia-quilt-column-single lia-quilt-column-message-body-content"&gt;&lt;DIV class="lia-quilt-column-alley lia-quilt-column-alley-single"&gt;&lt;DIV class="lia-message-body lia-component-message-view-widget-body lia-component-body-signature-highlight-escalation lia-component-message-view-widget-body-signature-highlight-escalation"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;Hello all&lt;/P&gt;&lt;P&gt;I'm facing the following issue and I can't seem to find a way to fix it.&lt;/P&gt;&lt;P&gt;I'm trying to get an overview of all vpn's created on our check point platform.&lt;/P&gt;&lt;P&gt;I'm doing this by executing the following task in my playbook on 2 hosts in my inventory:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Task:&lt;/P&gt;&lt;P&gt;- name: show-vpn-communities-star on chosen firewall&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; cp_mgmt_vpn_community_star_facts:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; details_level: full&lt;BR /&gt;&amp;nbsp;&amp;nbsp; register: existing_star_vpns_on_fw&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Inventory:&lt;/P&gt;&lt;P&gt;Aveve ansible_host=10.248.0.254 ansible_checkpoint_domain=Aveve&lt;BR /&gt;Renewi ansible_host=10.248.0.254 ansible_checkpoint_domain=Renewi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Running this playbook from AWX and debugging the registered variable: existing_star_vpns_on_fw gives me the same output twice (once for each host it was run on):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;TASK [show-vpn-communities-star on chosen firewall] ****************************&lt;BR /&gt;ok: [Aveve]&lt;BR /&gt;&amp;#27;[&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;ok: [Renewi]&lt;BR /&gt;&amp;#27;[&lt;/P&gt;&lt;P&gt;TASK [debug] *******************************************************************&lt;BR /&gt;ok: [Aveve] =&amp;gt;&lt;BR /&gt;"msg": "VPN name: S2S-CI00060823-Actemium, peer ip: x.x.x.x"&lt;BR /&gt;}&lt;BR /&gt;&amp;#27;[&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;ok: [Aveve] =&amp;gt;&lt;BR /&gt;"msg": "VPN name: test-vpn, peer ip: 1.1.1.1"&lt;BR /&gt;}&lt;BR /&gt;&amp;#27;[&lt;BR /&gt;ok: [Renewi] =&amp;gt;&lt;BR /&gt;"msg": "VPN name: S2S-CI00060823-Actemium, peer ip: x.x.x.x"&lt;BR /&gt;}&lt;BR /&gt;&amp;#27;[&lt;/P&gt;&lt;P&gt;ok: [Renewi] =&amp;gt;&lt;BR /&gt;"msg": "VPN name: test-vpn, peer ip: 1.1.1.1"&lt;BR /&gt;}&lt;BR /&gt;&amp;#27;[&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The output I'm getting are only the vpn's on Aveve. It almost seems that Ansible can't handle registered variables on multiple domains on 1 ansible host: 10.248.0.254. Does anyone have an idea how to prevent this?&lt;BR /&gt;Executing the same playbook on just 1 domain works perfectly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Complete playbook:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- name: Check vpn's on Check Point platform&lt;BR /&gt;connection: httpapi&lt;BR /&gt;hosts: Aveve,Renewi&lt;BR /&gt;gather_facts: no&lt;BR /&gt;&lt;BR /&gt;tasks:&lt;/P&gt;&lt;P&gt;- name: Setting password for NSAutomation user as fact&lt;BR /&gt;set_fact:&lt;BR /&gt;ansible_password: "{{ NSAutomation_pass }}"&lt;BR /&gt;&lt;BR /&gt;- name: show-vpn-communities-star on chosen firewall&lt;BR /&gt;cp_mgmt_vpn_community_star_facts:&lt;BR /&gt;details_level: full&lt;BR /&gt;register: existing_star_vpns_on_fw&lt;BR /&gt;&lt;BR /&gt;- debug:&lt;BR /&gt;msg: "VPN name: {{ item.name }}, peer ip: {{ item['satellite-gateways'][0]['ipv4-address'] }}"&lt;BR /&gt;loop: "{{ existing_star_vpns_on_fw.ansible_facts['vpn-communities-star'].objects }}"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 16 Apr 2020 10:10:54 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-getting-info-from-multiple-domains-from-provider/m-p/82095#M281</guid>
      <dc:creator>Cegeka_Networki</dc:creator>
      <dc:date>2020-04-16T10:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible - getting info from multiple domains from provider</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-getting-info-from-multiple-domains-from-provider/m-p/82336#M284</link>
      <description>I assume you're talking about a Multi-Domain environment here.&lt;BR /&gt;Shouldn't you use the CMA IP for each domain here?&lt;BR /&gt;</description>
      <pubDate>Sat, 18 Apr 2020 21:28:05 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-getting-info-from-multiple-domains-from-provider/m-p/82336#M284</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2020-04-18T21:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible - getting info from multiple domains from provider</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-getting-info-from-multiple-domains-from-provider/m-p/82740#M292</link>
      <description>I indeed decided to send my requests to the CMA's directly rather than the provider seeing as a register task is always saved on the host ip.</description>
      <pubDate>Wed, 22 Apr 2020 08:35:30 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-getting-info-from-multiple-domains-from-provider/m-p/82740#M292</guid>
      <dc:creator>Cegeka_Networki</dc:creator>
      <dc:date>2020-04-22T08:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible - getting info from multiple domains from provider</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-getting-info-from-multiple-domains-from-provider/m-p/82806#M295</link>
      <description>You list the same IP for both domains...so I'm confused.</description>
      <pubDate>Wed, 22 Apr 2020 17:05:56 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-getting-info-from-multiple-domains-from-provider/m-p/82806#M295</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2020-04-22T17:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible - getting info from multiple domains from provider</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-getting-info-from-multiple-domains-from-provider/m-p/83141#M296</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Normally you would run your playbook in a MDM scenario against your mgmt-ip and the domain will be a variable.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;- name: Check vpn's on Check Point platform
connection: httpapi
hosts: MGMT-IP
gather_facts: no
vars: 
  ansible_checkpoint_domain: "Domain 1"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;It think you have to use the&amp;nbsp; module cp_mgmt_mds_facts to get all domains and create a list of domains to loop your task through all domains (&lt;A href="https://docs.ansible.com/ansible/latest/modules/cp_mgmt_mds_facts_module.html#cp-mgmt-mds-facts-module" target="_blank"&gt;https://docs.ansible.com/ansible/latest/modules/cp_mgmt_mds_facts_module.html#cp-mgmt-mds-facts-module&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Apr 2020 10:59:14 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-getting-info-from-multiple-domains-from-provider/m-p/83141#M296</guid>
      <dc:creator>IdentityUnknown</dc:creator>
      <dc:date>2020-04-25T10:59:14Z</dc:date>
    </item>
  </channel>
</rss>

