<?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 Adding Rules to a Rule Section Using Ansible in Ansible</title>
    <link>https://community.checkpoint.com/t5/Ansible/Adding-Rules-to-a-Rule-Section-Using-Ansible/m-p/62438#M26</link>
    <description>&lt;P&gt;Dear all,&lt;/P&gt;
&lt;P&gt;we are using the Check Point Ansible module&amp;nbsp;&lt;A href="https://github.com/CheckPointSW/cpAnsible" target="_blank" rel="noopener"&gt;https://github.com/CheckPointSW/cpAnsible&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you know how to group access rules below a section?&lt;/P&gt;
&lt;P&gt;The API tells me:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://sc1.checkpoint.com/documents/latest/APIs/#cli/add-access-rule~v1.5%20" target="_blank" rel="noopener"&gt;https://sc1.checkpoint.com/documents/latest/APIs/#cli/add-access-rule~v1.5%20&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;But how to convert it to an ansible playbook?&lt;/P&gt;
&lt;P&gt;Only the "position: "top"" statement seems to be working. I commented the other attempts out.&lt;/P&gt;
&lt;P&gt;Any ideas?&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: "Section"
    check_point_mgmt:
      command: add-access-section
      parameters:
        layer: "Network"
		name: "section 1"
        position: "top"
      session-data: "{{login_response}}"

  - name: "Rule"
    check_point_mgmt:
      command: add-access-rule
      parameters:
        layer: "Network"
#        position.below: "section 1"
#		 position: "section 1"
        position: "top"
        name: "Access rule"
        source: "1.1.1.1"
        destination: "2.2.2.2"
        service: "ssh"
        action: "allow"
      session-data: "{{login_response}}"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you &amp;amp; kind regards&lt;/P&gt;</description>
    <pubDate>Mon, 16 Sep 2019 00:24:59 GMT</pubDate>
    <dc:creator>IdentityUnknown</dc:creator>
    <dc:date>2019-09-16T00:24:59Z</dc:date>
    <item>
      <title>Adding Rules to a Rule Section Using Ansible</title>
      <link>https://community.checkpoint.com/t5/Ansible/Adding-Rules-to-a-Rule-Section-Using-Ansible/m-p/62438#M26</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;
&lt;P&gt;we are using the Check Point Ansible module&amp;nbsp;&lt;A href="https://github.com/CheckPointSW/cpAnsible" target="_blank" rel="noopener"&gt;https://github.com/CheckPointSW/cpAnsible&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you know how to group access rules below a section?&lt;/P&gt;
&lt;P&gt;The API tells me:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://sc1.checkpoint.com/documents/latest/APIs/#cli/add-access-rule~v1.5%20" target="_blank" rel="noopener"&gt;https://sc1.checkpoint.com/documents/latest/APIs/#cli/add-access-rule~v1.5%20&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;But how to convert it to an ansible playbook?&lt;/P&gt;
&lt;P&gt;Only the "position: "top"" statement seems to be working. I commented the other attempts out.&lt;/P&gt;
&lt;P&gt;Any ideas?&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: "Section"
    check_point_mgmt:
      command: add-access-section
      parameters:
        layer: "Network"
		name: "section 1"
        position: "top"
      session-data: "{{login_response}}"

  - name: "Rule"
    check_point_mgmt:
      command: add-access-rule
      parameters:
        layer: "Network"
#        position.below: "section 1"
#		 position: "section 1"
        position: "top"
        name: "Access rule"
        source: "1.1.1.1"
        destination: "2.2.2.2"
        service: "ssh"
        action: "allow"
      session-data: "{{login_response}}"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you &amp;amp; kind regards&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2019 00:24:59 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Adding-Rules-to-a-Rule-Section-Using-Ansible/m-p/62438#M26</guid>
      <dc:creator>IdentityUnknown</dc:creator>
      <dc:date>2019-09-16T00:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding Ansible with Check Point</title>
      <link>https://community.checkpoint.com/t5/Ansible/Adding-Rules-to-a-Rule-Section-Using-Ansible/m-p/62512#M27</link>
      <description>What error do you get?</description>
      <pubDate>Wed, 11 Sep 2019 20:16:01 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Adding-Rules-to-a-Rule-Section-Using-Ansible/m-p/62512#M27</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2019-09-11T20:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding Ansible with Check Point</title>
      <link>https://community.checkpoint.com/t5/Ansible/Adding-Rules-to-a-Rule-Section-Using-Ansible/m-p/62535#M28</link>
      <description>&lt;P&gt;With the following task:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;  - name: "Rule"
    check_point_mgmt:
      command: add-access-rule
      parameters:
        layer: "Network"
        position.below: "section 1"
        name: "Access rule"
        source: "1.1.1.1"
        destination: "2.2.2.2"
        service: "ssh"
        action: "allow"
      session-data: "{{login_response}}"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got&lt;/P&gt;&lt;LI-CODE lang="markup"&gt; "msg": "Command 'add-access-rule {u'layer': u'Network', u'name': u'Access rule', u'service': u'ssh', u'destination': u'2.2.2.2', u'position.below': u'section 1', u'source': u'1.1.1.1', u'action': u'allow'}' failed with error message: message: Unrecognized parameter [position.below]\ncode: generic_err_invalid_parameter_name\n. All changes are discarded and the session is invalidated."&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 06:38:39 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Adding-Rules-to-a-Rule-Section-Using-Ansible/m-p/62535#M28</guid>
      <dc:creator>IdentityUnknown</dc:creator>
      <dc:date>2019-09-12T06:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding Ansible with Check Point</title>
      <link>https://community.checkpoint.com/t5/Ansible/Adding-Rules-to-a-Rule-Section-Using-Ansible/m-p/62677#M29</link>
      <description>&lt;P&gt;My guess is you need to do something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;  - name: "Rule"
    check_point_mgmt:
      command: add-access-rule
      parameters:
        layer: "Network"
        position:
          below: "section 1"
        name: "Access rule"
        source: "1.1.1.1"
        destination: "2.2.2.2"
        service: "ssh"
        action: "accept"
      session-data: "{{login_response}}"&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Sep 2019 00:24:14 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Adding-Rules-to-a-Rule-Section-Using-Ansible/m-p/62677#M29</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2019-09-16T00:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding Ansible with Check Point</title>
      <link>https://community.checkpoint.com/t5/Ansible/Adding-Rules-to-a-Rule-Section-Using-Ansible/m-p/62717#M30</link>
      <description>&lt;P&gt;I tried it as well before, but the statement is reordered (position at the end of the statement) and the exception is:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;msg": "Command 'add-access-rule {u'layer': u'Network', u'name': u'Access rule', u'service': u'ssh', u'destination': u'2.2.2.2', u'source': u'1.1.1.1', u'action': u'allow', u'position': {u'below': u'section 1'}}' failed with error message: message: Invalid parameter for [action]. The invalid value: [allow]\ncode: generic_err_invalid_parameter\n. All changes are discarded and the session is invalidated."&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2019 12:24:40 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Adding-Rules-to-a-Rule-Section-Using-Ansible/m-p/62717#M30</guid>
      <dc:creator>IdentityUnknown</dc:creator>
      <dc:date>2019-09-13T12:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding Ansible with Check Point</title>
      <link>https://community.checkpoint.com/t5/Ansible/Adding-Rules-to-a-Rule-Section-Using-Ansible/m-p/62718#M31</link>
      <description>&lt;P&gt;I'm no expert when it comes to Ansible, but my guess is that the parameter for the action statement should be "accept" instead of "allow" - as mentioned in the &lt;A href="https://sc1.checkpoint.com/documents/latest/APIs/#cli/add-access-rule~v1.5%20" target="_self"&gt;API documentation&lt;/A&gt;:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN class="blue"&gt;action&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;string&lt;BR /&gt;&lt;SPAN class="grey"&gt;Default:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="blue"&gt;Drop&lt;/SPAN&gt;&lt;/TD&gt;&lt;TD&gt;&lt;SPAN class="description to_check_for_rewrite"&gt;"Accept", "Drop", "Ask", "Inform", "Reject", "User Auth", "Client Auth", "Apply Layer".&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 13 Sep 2019 12:56:13 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Adding-Rules-to-a-Rule-Section-Using-Ansible/m-p/62718#M31</guid>
      <dc:creator>Maik</dc:creator>
      <dc:date>2019-09-13T12:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding Ansible with Check Point</title>
      <link>https://community.checkpoint.com/t5/Ansible/Adding-Rules-to-a-Rule-Section-Using-Ansible/m-p/62721#M32</link>
      <description>&lt;P&gt;Yes, I worked with a typo in my example playbook.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The task is working as PhoneBoy mentioned with the action string "accept" which Maik mentioned.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Sep 2019 13:12:09 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Adding-Rules-to-a-Rule-Section-Using-Ansible/m-p/62721#M32</guid>
      <dc:creator>IdentityUnknown</dc:creator>
      <dc:date>2019-09-13T13:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding Ansible with Check Point</title>
      <link>https://community.checkpoint.com/t5/Ansible/Adding-Rules-to-a-Rule-Section-Using-Ansible/m-p/62729#M33</link>
      <description>All I did was propagate the original mistake, fixed in my answer.</description>
      <pubDate>Fri, 13 Sep 2019 16:15:13 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Adding-Rules-to-a-Rule-Section-Using-Ansible/m-p/62729#M33</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2019-09-13T16:15:13Z</dc:date>
    </item>
  </channel>
</rss>

