From d84c6ba00a4b0510a4d5d7045e37bf81b939ad0b Mon Sep 17 00:00:00 2001 From: agatha Date: Sat, 26 Apr 2025 13:29:24 -0400 Subject: [PATCH] output generated passwords to file --- playbooks/setup_base_system.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/playbooks/setup_base_system.yml b/playbooks/setup_base_system.yml index bfdd15c..e8d8fcf 100644 --- a/playbooks/setup_base_system.yml +++ b/playbooks/setup_base_system.yml @@ -8,13 +8,19 @@ connection: local gather_facts: false tasks: - - name: Display all generated passwords - debug: - msg: | + - name: Prepare password information + set_fact: + password_info: | Generated Passwords: {% for host in groups['all'] %} {% if hostvars[host]['generated_password'] is defined %} - Host: {{ host }} - Password: {{ hostvars[host]['generated_password'] }} + Host: {{ host }} + Password: {{ hostvars[host]['generated_password'] }} + {% endif %} - {% endfor %} \ No newline at end of file + {% endfor %} + + - name: Write password information to file + copy: + content: "{{ password_info }}" + dest: "../generated_passwords.txt" \ No newline at end of file