๐Ÿ“— Ansible playbooks and roles for building an idempotent, interconnected and scalable infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
ansible-playbooks/roles/workstation/tasks/get_all_hkus.yml

20 lines
618 B

- name: get all HKUs
win_reg_stat:
path: HKU:\
register: all_hkus
failed_when: not all_hkus.exists or ((all_hkus.sub_keys | default([])) | length == 0)
- name: filter HKUs that are valid and correspond to actual users
set_fact:
good_hkus: "{{ all_hkus.sub_keys | select('match', '^S-1-5-21-\\d+-\\d+-\\d+-\\d+$') | list }}"
failed_when: (good_hkus | default([]) | length) == 0
- debug:
msg: "got HKUs: {{ good_hkus | join(', ') }}"
- name: combine HKUs with root HKU to form a full registry path
set_fact:
hkus: "{{ good_hkus | map('regex_replace', '^(.*)$', 'HKU:\\\\\\1') | list }}"