<?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 playbook, error add network AND host in Ansible</title>
    <link>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94323#M360</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Based on&amp;nbsp;&lt;A href="https://docs.ansible.com/ansible/latest/modules/cp_mgmt_host_module.html" target="_blank" rel="noopener"&gt;this and&amp;nbsp;&lt;/A&gt;&lt;A href="https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&amp;amp;solutionid=sk114661&amp;amp;partition=General&amp;amp;product=Security" target="_self"&gt;SK&lt;/A&gt;&lt;BR /&gt;try:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="ruby"&gt;- name: add-host
  cp_mgmt_host:
    ip_address: 192.0.2.1
    name: New Host 1
    state: present&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 17 Aug 2020 09:18:25 GMT</pubDate>
    <dc:creator>funkylicious</dc:creator>
    <dc:date>2020-08-17T09:18:25Z</dc:date>
    <item>
      <title>Ansible playbook, error add network AND host</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94264#M354</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I just started playing with Ansible. I Needs some help. I build a test setup:&lt;BR /&gt;- Using: ansible-galaxy collection install check_point.mgmt, v1.0.6&lt;BR /&gt;- Smartcenter R80.40, latest jumbo&lt;/P&gt;&lt;P&gt;Everything is working, I am able to create a network object using a playbook. My working example:&lt;/P&gt;&lt;P&gt;----------- WORKING PLAYBOOK&amp;nbsp;-----------&lt;/P&gt;&lt;P&gt;- name: playbook name&lt;BR /&gt;hosts: check_point&lt;BR /&gt;connection: httpapi&lt;BR /&gt;tasks:&lt;BR /&gt;- name: This is the first network&lt;BR /&gt;cp_mgmt_network:&lt;BR /&gt;name: "TEST"&lt;BR /&gt;subnet: 1.1.1.0&lt;BR /&gt;mask_length: 24&lt;BR /&gt;cp_mgmt_network:&lt;BR /&gt;name: "TEST2"&lt;BR /&gt;subnet: 2.2.2.0&lt;BR /&gt;mask_length: 24&lt;BR /&gt;auto_publish_session: true&lt;/P&gt;&lt;P&gt;---------------------------------------------------&lt;/P&gt;&lt;P&gt;Now my challenge, I would like to extend this playbook to add also a host object. My new script:&amp;nbsp;&lt;/P&gt;&lt;P&gt;------------ FAILED PLAYBOOK --------------------&lt;/P&gt;&lt;P&gt;- name: playbook name&lt;BR /&gt;hosts: check_point&lt;BR /&gt;connection: httpapi&lt;BR /&gt;tasks:&lt;BR /&gt;- name: "Test with two Check Point networks"&lt;BR /&gt;cp_mgmt_network:&lt;BR /&gt;name: "TEST"&lt;BR /&gt;subnet: 1.1.1.0&lt;BR /&gt;mask_length: 24&lt;BR /&gt;cp_mgmt_network:&lt;BR /&gt;name: "TEST2"&lt;BR /&gt;subnet: 2.2.2.0&lt;BR /&gt;mask_length: 24&lt;BR /&gt;- name: "Add a new host object"&lt;BR /&gt;cp_mgmt_host:&lt;BR /&gt;name: "Test3"&lt;BR /&gt;ip_address: 3.3.3.3&lt;/P&gt;&lt;P&gt;-----------------------------------------------------&lt;/P&gt;&lt;P&gt;Error output:&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR! Syntax Error while loading YAML.&lt;BR /&gt;did not find expected '-' indicator&lt;/P&gt;&lt;P&gt;The error appears to be in '/etc/ansible/test.yml': line 14, column 6, but may&lt;BR /&gt;be elsewhere in the file depending on the exact syntax problem.&lt;/P&gt;&lt;P&gt;The offending line appears to be:&lt;/P&gt;&lt;P&gt;mask_length: 24&lt;BR /&gt;- name: "Add a new host object"&lt;BR /&gt;^ here&lt;/P&gt;&lt;P&gt;-----------------------------------------------------&lt;/P&gt;&lt;P&gt;Could you please assist? I am really new to ansible.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!!!&lt;/P&gt;&lt;P&gt;Regards, Paul&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2020 09:52:57 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94264#M354</guid>
      <dc:creator>pabu</dc:creator>
      <dc:date>2020-08-16T09:52:57Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible playbook, error add network AND host</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94285#M355</link>
      <description>&lt;P&gt;It would be helpful if you attached the exact script used.&lt;BR /&gt;Indents matter quite a bit and it’s difficult to see with what was pasted to the community.&lt;/P&gt;</description>
      <pubDate>Sun, 16 Aug 2020 19:09:15 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94285#M355</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2020-08-16T19:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible playbook, error add network AND host</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94298#M356</link>
      <description>&lt;P&gt;Added two files, the faulty script and the error output.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 06:43:50 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94298#M356</guid>
      <dc:creator>pabu</dc:creator>
      <dc:date>2020-08-17T06:43:50Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible playbook, error add network AND host</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94315#M357</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Please try and add a empty line between the tasks of network creation and host creation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 08:22:23 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94315#M357</guid>
      <dc:creator>funkylicious</dc:creator>
      <dc:date>2020-08-17T08:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible playbook, error add network AND host</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94320#M358</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for your help! Still not working with a empty line.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards, Paul&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 09:00:20 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94320#M358</guid>
      <dc:creator>pabu</dc:creator>
      <dc:date>2020-08-17T09:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible playbook, error add network AND host</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94323#M360</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Based on&amp;nbsp;&lt;A href="https://docs.ansible.com/ansible/latest/modules/cp_mgmt_host_module.html" target="_blank" rel="noopener"&gt;this and&amp;nbsp;&lt;/A&gt;&lt;A href="https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&amp;amp;solutionid=sk114661&amp;amp;partition=General&amp;amp;product=Security" target="_self"&gt;SK&lt;/A&gt;&lt;BR /&gt;try:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="ruby"&gt;- name: add-host
  cp_mgmt_host:
    ip_address: 192.0.2.1
    name: New Host 1
    state: present&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 09:18:25 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94323#M360</guid>
      <dc:creator>funkylicious</dc:creator>
      <dc:date>2020-08-17T09:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible playbook, error add network AND host</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94324#M361</link>
      <description>&lt;P&gt;Dear funkylicious,&lt;/P&gt;&lt;P&gt;Still not working. The add-host is working if I am using it in a playbook alone. When I combine it with the cp_mgmt_network I get errors. I added the script and output below.&lt;/P&gt;&lt;P&gt;Regards, Paul&lt;/P&gt;&lt;P&gt;---------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;@ansible01:/etc/ansible# cat test2.yml&lt;BR /&gt;---&lt;BR /&gt;- name: playbook name&lt;BR /&gt;hosts: check_point&lt;BR /&gt;connection: httpapi&lt;BR /&gt;tasks:&lt;BR /&gt;- name: "Test with two Check Point networks"&lt;BR /&gt;cp_mgmt_network:&lt;BR /&gt;name: "TEST"&lt;BR /&gt;subnet: 1.1.1.0&lt;BR /&gt;mask_length: 24&lt;BR /&gt;cp_mgmt_network:&lt;BR /&gt;name: "TEST2"&lt;BR /&gt;subnet: 2.2.2.0&lt;BR /&gt;mask_length: 24&lt;/P&gt;&lt;P&gt;- name: add-host&lt;BR /&gt;cp_mgmt_host:&lt;BR /&gt;ip_address: 192.8.2.1&lt;BR /&gt;name: New host&lt;BR /&gt;state: present&lt;/P&gt;&lt;P&gt;---------------------------------------------------------------------&lt;BR /&gt;root@ansible01:/etc/ansible# ansible-playbook test2.yml&lt;BR /&gt;ERROR! Syntax Error while loading YAML.&lt;BR /&gt;did not find expected '-' indicator&lt;/P&gt;&lt;P&gt;The error appears to be in '/etc/ansible/test2.yml': line 16, column 6, but may&lt;BR /&gt;be elsewhere in the file depending on the exact syntax problem.&lt;/P&gt;&lt;P&gt;The offending line appears to be:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;- name: add-host&lt;BR /&gt;^ here&lt;/P&gt;&lt;P&gt;---------------------------------------------------------------------&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 09:22:10 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94324#M361</guid>
      <dc:creator>pabu</dc:creator>
      <dc:date>2020-08-17T09:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible playbook, error add network AND host</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94325#M362</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Sorry, but i didn't pay enough attention to your playbook/details.&lt;/P&gt;&lt;P&gt;Apparently, from my understanding you cannot combine multiple modules in the same playbook, e.g&amp;nbsp;&lt;SPAN&gt;cp_mgmt_network and&amp;nbsp;cp_mgmt_host , so you would require individual playbooks for different tasks/modules.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If I misread/misunderstood this, someone please correct me.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 09:30:51 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94325#M362</guid>
      <dc:creator>funkylicious</dc:creator>
      <dc:date>2020-08-17T09:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible playbook, error add network AND host</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94361#M363</link>
      <description>&lt;P&gt;Ow really, are you sure about this? Should explain a lot :-)!&lt;/P&gt;</description>
      <pubDate>Mon, 17 Aug 2020 13:30:52 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94361#M363</guid>
      <dc:creator>pabu</dc:creator>
      <dc:date>2020-08-17T13:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible playbook, error add network AND host</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94641#M364</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Its working when I use seperate playbooks, one for each module. For example:&amp;nbsp;&lt;/P&gt;&lt;P&gt;main-playbook.yml&lt;BR /&gt;- import_playbook: playbook-add-network-objects.yml&lt;BR /&gt;- import_playbook: playbook-add-host-objects.yml&lt;/P&gt;&lt;P&gt;Regards, Paul&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 18:23:43 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94641#M364</guid>
      <dc:creator>pabu</dc:creator>
      <dc:date>2020-08-19T18:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible playbook, error add network AND host</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94807#M368</link>
      <description>&lt;P&gt;Well, theres a yaml syntax error. see attached screenshot and fix the indent in the according line.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Aug 2020 23:41:07 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/94807#M368</guid>
      <dc:creator>Daniel_Schlifka</dc:creator>
      <dc:date>2020-08-20T23:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible playbook, error add network AND host</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/95834#M375</link>
      <description>&lt;P&gt;Thanks!!! I dont understand whats wrong in the syntax, should be OK?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Sep 2020 08:50:52 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-playbook-error-add-network-AND-host/m-p/95834#M375</guid>
      <dc:creator>pabu</dc:creator>
      <dc:date>2020-09-02T08:50:52Z</dc:date>
    </item>
  </channel>
</rss>

