<?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: How to add host to existing rule via ansible in Ansible</title>
    <link>https://community.checkpoint.com/t5/Ansible/How-to-add-host-to-existing-rule-via-ansible/m-p/27471#M224</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure how Ansible works, but source can be an object {}&amp;nbsp;list [] or string "".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In mgmt_cli we deal with objects like you already found source.add test, which in JSON would be {"source": {"add": "test"}}. Need to understand the Ansible interpretation of the same.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Jan 2019 13:41:45 GMT</pubDate>
    <dc:creator>Joshua_Hatter</dc:creator>
    <dc:date>2019-01-25T13:41:45Z</dc:date>
    <item>
      <title>How to add host to existing rule via ansible</title>
      <link>https://community.checkpoint.com/t5/Ansible/How-to-add-host-to-existing-rule-via-ansible/m-p/27470#M223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Guys,&lt;/P&gt;&lt;P&gt;I'm starting with checkpoint automatization with ansible, and I'm facing following issue.&lt;/P&gt;&lt;P&gt;API command for adding host (source/destination) is source.add.&lt;/P&gt;&lt;P&gt;I tried it from mgmt_cli and it worked fine:&lt;/P&gt;&lt;P&gt;[Expert@checkpoint:0]# mgmt_cli set access-rule layer "Network" rule-number 2 source.add test&lt;BR /&gt;Username: guoth&lt;BR /&gt;Password:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;---------------------------------------------&lt;BR /&gt;Time: [10:38:57] 25/1/2019&lt;BR /&gt;---------------------------------------------&lt;BR /&gt;"Publish operation" succeeded (100%)&lt;BR /&gt;[Expert@checkpoint:0]#&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, when I got command source.add in ansible, it comes with error, that source.add is not valid parameter:&lt;/P&gt;&lt;P&gt;*&lt;BR /&gt;fatal: [localhost]: FAILED! =&amp;gt; {"changed": false, "msg": "Command 'set-access-rule {u'layer': u'Network', u'source.add': u'source3', u'rule-position': 2}' failed with error message: Unrecognized parameter [source.add]. All changes are discarded and the session is invalidated."}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my task in ansible:&lt;/P&gt;&lt;P&gt;- name: adding&amp;nbsp;host&lt;BR /&gt;&amp;nbsp; check_point_mgmt:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; command: set-access-rule&lt;BR /&gt;&amp;nbsp; &amp;nbsp; parameters:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; rule-position: 2&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; layer: Network&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; source.add: source3&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; session-data: "{{ login_response }}"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for help in advance!&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2019 09:46:34 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/How-to-add-host-to-existing-rule-via-ansible/m-p/27470#M223</guid>
      <dc:creator>Miroslav_Guoth</dc:creator>
      <dc:date>2019-01-25T09:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to add host to existing rule via ansible</title>
      <link>https://community.checkpoint.com/t5/Ansible/How-to-add-host-to-existing-rule-via-ansible/m-p/27471#M224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure how Ansible works, but source can be an object {}&amp;nbsp;list [] or string "".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In mgmt_cli we deal with objects like you already found source.add test, which in JSON would be {"source": {"add": "test"}}. Need to understand the Ansible interpretation of the same.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2019 13:41:45 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/How-to-add-host-to-existing-rule-via-ansible/m-p/27471#M224</guid>
      <dc:creator>Joshua_Hatter</dc:creator>
      <dc:date>2019-01-25T13:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to add host to existing rule via ansible</title>
      <link>https://community.checkpoint.com/t5/Ansible/How-to-add-host-to-existing-rule-via-ansible/m-p/27472#M225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Joshua, it worked like:&lt;BR /&gt; source: {"add": "source3"}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2019 19:21:22 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/How-to-add-host-to-existing-rule-via-ansible/m-p/27472#M225</guid>
      <dc:creator>Miroslav_Guoth</dc:creator>
      <dc:date>2019-01-25T19:21:22Z</dc:date>
    </item>
  </channel>
</rss>

