Here are new Ansible modules for managing locally defined users on a management server.
https://github.com/duanetoler/AnsibleModule-cp_mgmt_user.git
Main play task:
---
- 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
...
reset_passwords.yml:
---
- 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
...