<?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 Ansible modules for cp_mgmt_user and cp_mgmt_user_facts in Automation and APIs</title>
    <link>https://community.checkpoint.com/t5/Automation-and-APIs/Ansible-modules-for-cp-mgmt-user-and-cp-mgmt-user-facts/m-p/215812#M18</link>
    <description>&lt;DIV class="thread-description"&gt;
&lt;DIV id="bodyDisplay_7674d3323c5a00" class="lia-message-body lia-component-message-view-widget-body lia-component-body-signature-highlight-escalation lia-component-message-view-widget-body-signature-highlight-escalation"&gt;
&lt;DIV class="lia-message-body-content"&gt;
&lt;P&gt;Here are new Ansible modules for managing locally defined users on a management server.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/duanetoler/AnsibleModule-cp_mgmt_user.git" target="_blank" rel="nofollow noopener noreferrer"&gt;https://github.com/duanetoler/AnsibleModule-cp_mgmt_user.git&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Main play task:&lt;/P&gt;
&lt;PRE class="lia-code-sample  language-markup"&gt;&lt;CODE&gt;---
- name: Get local users
  check_point.mgmt.cp_mgmt_user_facts:
    details_level: full
  register: local_user_facts

- include_tasks: reset_passwords.yml
  loop: "{{ local_user_facts['ansible_facts']['users']['objects'] }}"
  loop_control:
    loop_var: user_item
    label: "{{ user_item.name }}"

- check_point.mgmt.cp_mgmt_publish:
    wait_for_task: true
...

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;reset_passwords.yml:&lt;/P&gt;
&lt;PRE class="lia-code-sample  language-markup"&gt;&lt;CODE&gt;---
- name: "Generate new password | {{ user_item.name }}"
  set_fact:
    new_user_pwd: "{{ lookup('ansible.builtin.password', user_item.name+'.pw.txt length=15 chars=ascii_lowercase,ascii_uppercase,digits,.-_=@+') }}"

- debug:
    msg: "{{ user_item.name }}: {{ new_user_pwd }}"

- name: Set user password
  check_point.mgmt.cp_mgmt_user:
    name: "{{ user_item.name }}"
    password: "{{ new_user_pwd }}"
    authentication_method: "check point password"
    ignore_errors: true

...
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;</description>
    <pubDate>Thu, 30 May 2024 20:58:56 GMT</pubDate>
    <dc:creator>Duane_Toler</dc:creator>
    <dc:date>2024-05-30T20:58:56Z</dc:date>
    <item>
      <title>Ansible modules for cp_mgmt_user and cp_mgmt_user_facts</title>
      <link>https://community.checkpoint.com/t5/Automation-and-APIs/Ansible-modules-for-cp-mgmt-user-and-cp-mgmt-user-facts/m-p/215812#M18</link>
      <description>&lt;DIV class="thread-description"&gt;
&lt;DIV id="bodyDisplay_7674d3323c5a00" class="lia-message-body lia-component-message-view-widget-body lia-component-body-signature-highlight-escalation lia-component-message-view-widget-body-signature-highlight-escalation"&gt;
&lt;DIV class="lia-message-body-content"&gt;
&lt;P&gt;Here are new Ansible modules for managing locally defined users on a management server.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/duanetoler/AnsibleModule-cp_mgmt_user.git" target="_blank" rel="nofollow noopener noreferrer"&gt;https://github.com/duanetoler/AnsibleModule-cp_mgmt_user.git&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Main play task:&lt;/P&gt;
&lt;PRE class="lia-code-sample  language-markup"&gt;&lt;CODE&gt;---
- name: Get local users
  check_point.mgmt.cp_mgmt_user_facts:
    details_level: full
  register: local_user_facts

- include_tasks: reset_passwords.yml
  loop: "{{ local_user_facts['ansible_facts']['users']['objects'] }}"
  loop_control:
    loop_var: user_item
    label: "{{ user_item.name }}"

- check_point.mgmt.cp_mgmt_publish:
    wait_for_task: true
...

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;reset_passwords.yml:&lt;/P&gt;
&lt;PRE class="lia-code-sample  language-markup"&gt;&lt;CODE&gt;---
- name: "Generate new password | {{ user_item.name }}"
  set_fact:
    new_user_pwd: "{{ lookup('ansible.builtin.password', user_item.name+'.pw.txt length=15 chars=ascii_lowercase,ascii_uppercase,digits,.-_=@+') }}"

- debug:
    msg: "{{ user_item.name }}: {{ new_user_pwd }}"

- name: Set user password
  check_point.mgmt.cp_mgmt_user:
    name: "{{ user_item.name }}"
    password: "{{ new_user_pwd }}"
    authentication_method: "check point password"
    ignore_errors: true

...
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 30 May 2024 20:58:56 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Automation-and-APIs/Ansible-modules-for-cp-mgmt-user-and-cp-mgmt-user-facts/m-p/215812#M18</guid>
      <dc:creator>Duane_Toler</dc:creator>
      <dc:date>2024-05-30T20:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Ansible modules for cp_mgmt_user and cp_mgmt_user_facts</title>
      <link>https://community.checkpoint.com/t5/Automation-and-APIs/Ansible-modules-for-cp-mgmt-user-and-cp-mgmt-user-facts/m-p/215814#M19</link>
      <description>&lt;P&gt;FYI, the cp_mgmt_user module has limited parameters, I'm afraid. &amp;nbsp;This is meant for temporary use until R&amp;amp;D publishes their own official modules. &amp;nbsp;It's meant just to handle the current CVE incident to reset local passwords.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 May 2024 21:04:07 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Automation-and-APIs/Ansible-modules-for-cp-mgmt-user-and-cp-mgmt-user-facts/m-p/215814#M19</guid>
      <dc:creator>Duane_Toler</dc:creator>
      <dc:date>2024-05-30T21:04:07Z</dc:date>
    </item>
  </channel>
</rss>

