<?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: no session-name with Ansible playbook in Ansible</title>
    <link>https://community.checkpoint.com/t5/Ansible/no-session-name-with-Ansible-playbook/m-p/56202#M191</link>
    <description>Only the login command allows you to set a session-name.&lt;BR /&gt;When you do the publish action, you specify the UID of the session.&lt;BR /&gt;&lt;BR /&gt;What is it you specify in the publish part of your playbook?</description>
    <pubDate>Wed, 19 Jun 2019 16:30:49 GMT</pubDate>
    <dc:creator>PhoneBoy</dc:creator>
    <dc:date>2019-06-19T16:30:49Z</dc:date>
    <item>
      <title>no session-name with Ansible playbook</title>
      <link>https://community.checkpoint.com/t5/Ansible/no-session-name-with-Ansible-playbook/m-p/56200#M190</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I would want to have the session name appear in the audit logs when pushing or publishing changes with the web-services API via Ansible.&lt;/P&gt;&lt;P&gt;Basically, what is done automatically when publishing in SmartConsole (see Capture.PNG).&lt;/P&gt;&lt;P&gt;However, session name is not set when using the session-name parameter in the login command (see Capture2.PNG), and therefore not in the logs neither (Capture3.PNG)&lt;/P&gt;&lt;P&gt;This is the login task I use (I want the session to use the ansible user and date, as well as a change ticket that the user will be prompted for):&lt;/P&gt;&lt;PRE&gt;- name: login into SmartConsole API
  check_point_mgmt:
    command: login
    parameters:
      username: "{{ cpuser }}"
      password: "{{ cppassword }}"
      management: "{{ cpserver }}"
      session-name: "{{ change_ticket | upper }} - {{ ansible_user_id | lower}} - {{ ansible_date_time.date }}"
    fingerprint: "{{ cpfingerprint }}"
  register: login_response&lt;/PRE&gt;&lt;P&gt;The session-name parameter is not rejected and the user is correctly logged in. It doesn't seem that the publish command permits to set a session name.&lt;/P&gt;&lt;P&gt;My management station is 80.10 and Ansible is in version 2.7.10.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;What am I doing wrong? Or is it some kind of bug? I did not find doc about this outside of&lt;/P&gt;&lt;P&gt;I don't have the issue I use the mgmt_cli tool in expert mode (Capture4.PNG).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help will be appreciated, thank you in advance.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 16:26:59 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/no-session-name-with-Ansible-playbook/m-p/56200#M190</guid>
      <dc:creator>System_Adminis4</dc:creator>
      <dc:date>2019-06-19T16:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: no session-name with Ansible playbook</title>
      <link>https://community.checkpoint.com/t5/Ansible/no-session-name-with-Ansible-playbook/m-p/56202#M191</link>
      <description>Only the login command allows you to set a session-name.&lt;BR /&gt;When you do the publish action, you specify the UID of the session.&lt;BR /&gt;&lt;BR /&gt;What is it you specify in the publish part of your playbook?</description>
      <pubDate>Wed, 19 Jun 2019 16:30:49 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/no-session-name-with-Ansible-playbook/m-p/56202#M191</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2019-06-19T16:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: no session-name with Ansible playbook</title>
      <link>https://community.checkpoint.com/t5/Ansible/no-session-name-with-Ansible-playbook/m-p/56211#M192</link>
      <description>&lt;P&gt;thanks for the confirmation, PhoneBoy!&lt;/P&gt;&lt;P&gt;I publish using the registered login-response from the login command&lt;/P&gt;&lt;PRE&gt;- name: publish changes
  check_point_mgmt:
    command: publish
    session-data: "{{ login_response }}"&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;presumably to use, I thought, the &lt;EM&gt;SID&lt;/EM&gt; of the session (~= --session-id in mgmt_cli command).&lt;/P&gt;&lt;P&gt;But you say I should use the UID? I'll give it try tomorrow, will keep you posted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for the fast answer!&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2019 18:45:57 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/no-session-name-with-Ansible-playbook/m-p/56211#M192</guid>
      <dc:creator>System_Adminis4</dc:creator>
      <dc:date>2019-06-19T18:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: no session-name with Ansible playbook</title>
      <link>https://community.checkpoint.com/t5/Ansible/no-session-name-with-Ansible-playbook/m-p/56255#M193</link>
      <description>&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;I actually did not try to specify a UID when publishing as I couldn't even see one in the login-response.&lt;/P&gt;&lt;P&gt;I however found a way to get what I wanted: use the set-session command with a new-name parameter after login. This successfully set a Name I could see in the Sessions tab of SmartConsole, as well as a Session Name in the changes and publish audit logs entries.&lt;/P&gt;&lt;P&gt;In summary, the session-name parameter doesn't work with the login command, but set-session one is happy to push the new-name parameter. So now, I use this instead of the single login from my original post:&lt;/P&gt;&lt;PRE&gt;- name: login into CP WebServices API
  check_point_mgmt:
    command: login
    parameters:
      username: "{{ cpuser }}"
      password: "{{ cppassword }}"
      management: "{{ cpserver }}"
    fingerprint: "{{ cpfingerprint }}"
  register: login_response

- name: set a session-name
  check_point_mgmt:
    command: set-session
    parameters:
      new-name: "{{ change_ticket | upper }} - {{ ansible_user_id | lower}} - {{ ansible_date_time.date}}"
    session-data: "{{ login_response }}"&lt;/PRE&gt;&lt;P&gt;Thanks for the help, I'll mark this as a solution.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 08:58:01 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/no-session-name-with-Ansible-playbook/m-p/56255#M193</guid>
      <dc:creator>System_Adminis4</dc:creator>
      <dc:date>2019-06-20T08:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: no session-name with Ansible playbook</title>
      <link>https://community.checkpoint.com/t5/Ansible/no-session-name-with-Ansible-playbook/m-p/56488#M194</link>
      <description>What version of the API were you trying to do this against?&lt;BR /&gt;It might very well be there's a bug when setting the session name on the login action.</description>
      <pubDate>Sun, 23 Jun 2019 21:35:01 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Ansible/no-session-name-with-Ansible-playbook/m-p/56488#M194</guid>
      <dc:creator>PhoneBoy</dc:creator>
      <dc:date>2019-06-23T21:35:01Z</dc:date>
    </item>
  </channel>
</rss>

