<?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 warnings type (dict) to type ( string) in Ansible</title>
    <link>https://community.checkpoint.com/t5/Ansible/Ansible-warnings-type-dict-to-type-string/m-p/55789#M72</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;The warning message you get seems to be because the parameters you wrote for your login command in the playbook is interpreted by the YAML parser as a dictionary, rather than as a string.&lt;/P&gt;
&lt;P&gt;I guess that later when Ansible tries to pass the parameters specified in the task to the check_point_mgmt module, since the parameters in the login command is defined as a dictionary, it converts the dictionary to a string and this generates the warning.&lt;/P&gt;
&lt;P&gt;Can you try to format your login command like we do in the example on our the &lt;A href="https://github.com/CheckPointSW/cpAnsible" target="_blank" rel="noopener"&gt;cpAnsible&lt;/A&gt; GitHub repository to something like this:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;- name: "login"
    check_point_mgmt:
      command: login
      parameters:
        username: "{{mgmt_user}}"           # Variables set in /etc/ansible/hosts, to avoid needing
        password: "{{mgmt_password}}"       # to type your login details in every playbook.
        management: "{{mgmt_server}}"
      fingerprint: "XX:XX:XX:XX:XX:XX"      # Mgmt Server's fingerprint
    register: login_response                # Register the output from the login
                                            # command so we can use it later to run commands.&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind Regards&lt;BR /&gt;Jim&lt;/P&gt;</description>
    <pubDate>Fri, 14 Jun 2019 07:46:52 GMT</pubDate>
    <dc:creator>Jim_Oqvist</dc:creator>
    <dc:date>2019-06-14T07:46:52Z</dc:date>
    <item>
      <title>Ansible warnings type (dict) to type ( string)</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-warnings-type-dict-to-type-string/m-p/55782#M71</link>
      <description>&lt;P&gt;Hi team,&lt;/P&gt;
&lt;P&gt;I am trying to use ansible with Red Hat Enterprise server 8 for a customer. The Playbook created works fine, However i get warnings like the one shown below.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ansible warning.png" style="width: 999px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/1553i827BE08753CC2569/image-size/large?v=v2&amp;amp;px=999" role="button" title="ansible warning.png" alt="ansible warning.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I can login to the management server and the objects.&lt;/P&gt;
&lt;P&gt;Any workarounds or solutions for this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 06:26:09 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-warnings-type-dict-to-type-string/m-p/55782#M71</guid>
      <dc:creator>Rajath__S_N</dc:creator>
      <dc:date>2019-06-14T06:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible warnings type (dict) to type ( string)</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-warnings-type-dict-to-type-string/m-p/55789#M72</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;The warning message you get seems to be because the parameters you wrote for your login command in the playbook is interpreted by the YAML parser as a dictionary, rather than as a string.&lt;/P&gt;
&lt;P&gt;I guess that later when Ansible tries to pass the parameters specified in the task to the check_point_mgmt module, since the parameters in the login command is defined as a dictionary, it converts the dictionary to a string and this generates the warning.&lt;/P&gt;
&lt;P&gt;Can you try to format your login command like we do in the example on our the &lt;A href="https://github.com/CheckPointSW/cpAnsible" target="_blank" rel="noopener"&gt;cpAnsible&lt;/A&gt; GitHub repository to something like this:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;- name: "login"
    check_point_mgmt:
      command: login
      parameters:
        username: "{{mgmt_user}}"           # Variables set in /etc/ansible/hosts, to avoid needing
        password: "{{mgmt_password}}"       # to type your login details in every playbook.
        management: "{{mgmt_server}}"
      fingerprint: "XX:XX:XX:XX:XX:XX"      # Mgmt Server's fingerprint
    register: login_response                # Register the output from the login
                                            # command so we can use it later to run commands.&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind Regards&lt;BR /&gt;Jim&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 07:46:52 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-warnings-type-dict-to-type-string/m-p/55789#M72</guid>
      <dc:creator>Jim_Oqvist</dc:creator>
      <dc:date>2019-06-14T07:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible warnings type (dict) to type ( string)</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-warnings-type-dict-to-type-string/m-p/55793#M73</link>
      <description>&lt;P&gt;the format seems correct.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ansible - play.png" style="width: 968px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/1555iDC0B4C2681C65466/image-size/large?v=v2&amp;amp;px=999" role="button" title="ansible - play.png" alt="ansible - play.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 08:11:53 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-warnings-type-dict-to-type-string/m-p/55793#M73</guid>
      <dc:creator>Rajath__S_N</dc:creator>
      <dc:date>2019-06-14T08:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible warnings type (dict) to type ( string)</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-warnings-type-dict-to-type-string/m-p/55819#M74</link>
      <description>Hi, &lt;BR /&gt;&lt;BR /&gt;I am getting the same warning after updating to the latest check_point_mgmt module from github.&lt;BR /&gt;&lt;BR /&gt;sysadmin@jimo-7480:~/Playbooks/AnsiblePolicyDemo$ ansible-playbook R80-login.yml&lt;BR /&gt;&lt;BR /&gt;PLAY [localhost] **************************************************************************************&lt;BR /&gt;&lt;BR /&gt;TASK [login] ******************************************************************************************&lt;BR /&gt; [WARNING]: The value {'username': 'admin', 'management': '172.27.254.10', 'domain': 'nordics',&lt;BR /&gt;'password': 'vpn123'} (type dict) in a string field was converted to u"{'username': 'admin',&lt;BR /&gt;'management': '172.27.254.10', 'domain': 'nordics', 'password': 'vpn123'}" (type string). If this does&lt;BR /&gt;not look like what you expect, quote the entire value to ensure it does not change.&lt;BR /&gt;&lt;BR /&gt;ok: [127.0.0.1]</description>
      <pubDate>Fri, 14 Jun 2019 12:48:29 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-warnings-type-dict-to-type-string/m-p/55819#M74</guid>
      <dc:creator>Jim_Oqvist</dc:creator>
      <dc:date>2019-06-14T12:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible warnings type (dict) to type ( string)</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-warnings-type-dict-to-type-string/m-p/55876#M75</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;It seems like it is not the updated module after all. &lt;BR /&gt;Thanks to &lt;a href="https://community.checkpoint.com/t5/user/viewprofilepage/user-id/6593"&gt;@Ryan_Darst&lt;/a&gt;&amp;nbsp;for pointing this out to me, there seems to be a behaviour changes in ansible 2.8 and later.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://docs.ansible.com/ansible/latest/porting_guides/porting_guide_2.8.html#module-option-conversion-to-string" target="_blank"&gt;https://docs.ansible.com/ansible/latest/porting_guides/porting_guide_2.8.html#module-option-conversion-to-string&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;A href="https://docs.ansible.com/ansible/latest/porting_guides/porting_guide_2.8.html#id7" target="_blank"&gt;Module option conversion to string&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Beginning in version 2.8, Ansible will warn if a module expects a string, but a non-string value is passed and automatically converted to a string. This highlights potential problems where, for example, a&amp;nbsp;yes&amp;nbsp;or&amp;nbsp;true&amp;nbsp;(parsed as truish boolean value) would be converted to the string&amp;nbsp;'True', or where a version number&amp;nbsp;1.10&amp;nbsp;(parsed as float value) would be converted to&amp;nbsp;'1.0'. Such conversions can result in unexpected behavior depending on context.&lt;/P&gt;
&lt;P&gt;This behavior can be changed to be an error or to be ignored by setting the&amp;nbsp;ANSIBLE_STRING_CONVERSION_ACTION&amp;nbsp;environment variable, or by setting the&amp;nbsp;string_conversion_action&amp;nbsp;configuration in the&amp;nbsp;defaults section of&amp;nbsp;ansible.cfg.&lt;/P&gt;
&lt;P&gt;You can add the following the defaults section of ~/.ansible.cfg or /etc/ansible/ansible.cfg&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;[defaults]
string_conversion_action = ignore&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;This is the result I get after adding that to my&amp;nbsp;~/.ansible.cfg&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2019-06-15_21-16-53.jpg" style="width: 400px;"&gt;&lt;img src="https://community.checkpoint.com/t5/image/serverpage/image-id/1569iBCD16B72445296CF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2019-06-15_21-16-53.jpg" alt="2019-06-15_21-16-53.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Please note that R&amp;amp;D is currently working on an official (by default included) module for ansible where this should be addressed.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jun 2019 19:19:21 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-warnings-type-dict-to-type-string/m-p/55876#M75</guid>
      <dc:creator>Jim_Oqvist</dc:creator>
      <dc:date>2019-06-15T19:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible warnings type (dict) to type ( string)</title>
      <link>https://community.checkpoint.com/t5/Ansible/Ansible-warnings-type-dict-to-type-string/m-p/56024#M76</link>
      <description>&lt;P&gt;Thanks for that!&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jun 2019 07:03:26 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/Ansible-warnings-type-dict-to-type-string/m-p/56024#M76</guid>
      <dc:creator>Rajath__S_N</dc:creator>
      <dc:date>2019-06-18T07:03:26Z</dc:date>
    </item>
  </channel>
</rss>

