forked from CCCHH/ansible-infra
		
	
		
			
				
	
	
		
			57 lines
		
	
	
	
		
			3.4 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
	
		
			3.4 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
| # CCCHH Ansible Repository
 | |
| 
 | |
| Folgende Geräte und Server werden duch dieses Ansible Repository verwaltet:
 | |
| 
 | |
| * Diverse VMs auf dem ThinkCCCluster
 | |
| * Diverse VMs auf dem Chaosknoten
 | |
| 
 | |
| Host-spezifische Konfigurationsdateien liegen unter `resources/` und werden für jeweils über eine `host_vars`-Datei im Inventory geladen.
 | |
| 
 | |
| ## Galaxy-Collections und -Rollen installieren
 | |
| 
 | |
| Für einige Aspekte verwenden wir Rollen aus Ansible Galaxy. Die müssen zunächst installiert werden:
 | |
| 
 | |
| ```bash
 | |
| ansible-galaxy install -r requirements.yml
 | |
| ```
 | |
| 
 | |
| ## Secrets
 | |
| 
 | |
| Generally try to avoid secrets (e.g. use SSH keys instead of passwords).
 | |
| 
 | |
| Because secrets are nonetheless needed sometimes, we use [SOPS](https://github.com/getsops/sops) to securely store secrets in this repository.  
 | |
| SOPS encrypts secrets according to "creation rules" which are defined in the `.sops.yaml`.
 | |
| Generally all secrets get encrypted for all GPG-keys of all members of the infrastructure team.  
 | |
| Ansible then has access to the secrets with the help of the [`community.sops.sops` vars plugin](https://docs.ansible.com/ansible/latest/collections/community/sops/docsite/guide.html#working-with-encrypted-variables), which is configured in this repository.
 | |
| A local Ansible run then uses the locally available GPG-key to decrypt the secrets.
 | |
| 
 | |
| 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:
 | |
| 
 | |
| ```bash
 | |
| ansible-playbook playbooks/deploy.yaml --inventory inventories/chaosknoten/hosts.yaml --limit public-reverse-proxy
 | |
| ```
 | |
| 
 | |
| ## Neuen Web-Service hinzufügen
 | |
| 
 | |
| Wir deployen Web-Services auf dem Chaosknoten hinter dem `public-reverse-proxy`. Der Service-Name `service.hamburg.ccc.de` sollte ein CNAME für `public-reverse-proxy.hamburg.ccc.de` und die Service-VM unter `service-intern.hamburg.ccc.de` mit einer `172.31.17.x`-Adresse erreichbar sein.
 | |
| 
 | |
| Im Ansible-Repo müssen diese Sachen hinzugefügt werden:
 | |
| * `inventories/chaosknoten/hosts.yaml`: 
 | |
|     * SSH-Config für die neue VM unter all/children/debian_12/hosts
 | |
|     * Einträge für die Rollen, die dieser Host haben soll, min. `certbot_hosts`, `nginx_hosts`, ggf. `docker_compose_hosts`
 | |
| * `inventories/chaosknoten/host_vars/`*host*`.yaml`: config vars für den neuen Host
 | |
| * `resources/chaosknoten/public-reverse-proxy/nginx/acme_challenge.conf`: Liste der Hostnamen um den neuen Host erweitern, die hinter dem Reverse-Proxy stehen
 | |
| * `resources/chaosknoten/public-reverse-proxy/nginx/nginx.conf`: Liste der Hostnamen um den neuen Host erweitern, die hinter dem Reverse-Proxy stehen
 | |
| * `resources/chaosknoten/`*host*`/nginx/`*host*`.hamburg.ccc.de.conf`: Server auf dem Service-Host
 | |
|     * Individuelle Config für den Service. Wenn Docker Compose, hier weiterleiten auf den eigentlichen Dienst in Compose.
 | |
|     * Cert-Dateinamen anpassen
 | |
| * `resources/chaosknoten/`*host*`/docker_compose/compose.yaml.j2`: Config für Docker Compose (wenn verwendet)
 | |
| 
 | |
| ## License
 | |
| 
 | |
| This CCCHH ansible-ccchh repository is licensed under the [MIT License](./LICENSE).  
 | |
| [`custom_pipeline_oidc_group_and_role_mapping.py`](./roles/netbox/files/custom_pipeline_oidc_group_and_role_mapping.py) is licensed under the Creative Commons: CC BY-SA 4.0 license.
 |