forked from CCCHH/ansible-infra
		
	document how to set up secrets using SOPS for a new host
This commit is contained in:
		
					parent
					
						
							
								eb70df37f1
							
						
					
				
			
			
				commit
				
					
						66e2e354b1
					
				
			
		
					 2 changed files with 17 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -24,6 +24,8 @@ SOPS verschlüsselt hier die Secrets nach den "creation rules", welche in der `s
 | 
			
		|||
Grundsätzlich werden hier alle Secrets für alle GPG-Keys aller Mitglieder des Infra-Teams verschlüsselt.  
 | 
			
		||||
Das eigentliche Laden der Secrets durch Ansible geschieht mit Hilfe des `community.sops.sops` lookup Plugins, welches entsprechend den lokalen GPG-Key benutzt, um die Secrets zu entschlüsseln.
 | 
			
		||||
 | 
			
		||||
For a tutorial on how to set up secrets using SOPS for a new host, see [Setting Up Secrets Using SOPS for a New Host](./docs/setting_up_secrets_using_sops_for_a_new_host.md).
 | 
			
		||||
 | 
			
		||||
## Playbook nur für einzelne Hosts ausführen
 | 
			
		||||
 | 
			
		||||
Ein paar der Hosts haben den selben Namen, was es etwas schwieriger macht, das Playbook nur für einen der Hosts auszuführen, z. B. `public-reverse-proxy`. Die Kombination aus `--inventory` und `--limit` führt zum Erfolg:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										15
									
								
								docs/setting_up_secrets_using_sops_for_a_new_host.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								docs/setting_up_secrets_using_sops_for_a_new_host.md
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,15 @@
 | 
			
		|||
# Setting Up Secrets Using SOPS for a New Host
 | 
			
		||||
 | 
			
		||||
1. Add a new creation rule for the hosts resources directory.
 | 
			
		||||
   It should probably hold all admin keys.  
 | 
			
		||||
   You can use existing creation rules as a reference.
 | 
			
		||||
2. Create a file containing the relevant secrets in the hosts resources directory.
 | 
			
		||||
   This can be accomplished with a command similar to this:
 | 
			
		||||
   ```
 | 
			
		||||
   sops resources/[chaosknoten|z9]/HOSTNAME/secrets.yaml
 | 
			
		||||
   ```
 | 
			
		||||
3. In the following an example on how to then use the `community.sops.sops` lookup plugin to use a secret for a host.
 | 
			
		||||
   In this particular instance the lookup plugin gets used to set the `nextcloud__postgres_password` variable in an inventories `host_vars` file to the secret value of the `DB_PASSWORD` YAML key:
 | 
			
		||||
   ```yaml
 | 
			
		||||
   nextcloud__postgres_password: "{{ lookup('community.sops.sops', 'resources/chaosknoten/cloud/secrets.yaml', extract='[\"DB_PASSWORD\"]') }}"
 | 
			
		||||
   ```
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue