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