pwgen: rewrite checks and passwords generation

This commit is contained in:
ace
2025-05-23 13:05:03 +03:00
parent e67b5702d5
commit 74ae2c4694
7 changed files with 246 additions and 303 deletions

View File

@ -1,7 +1,22 @@
- name: Create passwords.yaml file
- name: Check that passwords.yaml exists
stat:
path: "{{ inventory_dir }}/group_vars/all/passwords.yaml"
register: passwords_file
- name: Create passwords.yaml file if not exists
file:
name: "{{ inventory_dir }}/group_vars/all/passwords.yaml"
state: touch
when: not passwords_file.stat.exists
- name: Read passwords.yaml file
slurp:
src: "{{ inventory_dir }}/group_vars/all/passwords.yaml"
register: passwords_b64
- name: Set facts about passwords
set_fact:
passwords: "{{ passwords_b64['content'] | b64decode | from_yaml }}"
- name: Create files directory for ddclient tsig
file: