output generated passwords to file
This commit is contained in:
		
							parent
							
								
									089ce9b396
								
							
						
					
					
						commit
						d84c6ba00a
					
				@ -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 %}
 | 
			
		||||
          {% endfor %}
 | 
			
		||||
 | 
			
		||||
    - name: Write password information to file
 | 
			
		||||
      copy:
 | 
			
		||||
        content: "{{ password_info }}"
 | 
			
		||||
        dest: "../generated_passwords.txt"
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user