Housekeeping (#19)
* Vault-Password-File default location * absolute paths to relativ paths * keepass-pw.yml --> vault_pass.yml * vault-infos angepasst
This commit is contained in:
parent
532702f738
commit
8200ecb630
3 changed files with 17 additions and 22 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,4 +1,4 @@
|
|||
.git/
|
||||
keepass-pw.yml
|
||||
vault-pass.yml
|
||||
keepass_db.kdbx
|
||||
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
[defaults]
|
||||
inventory = /home/mg/ansible/inventories
|
||||
inventory = ~/ansible/inventories
|
||||
nocows = 1
|
||||
retry_files_enabled = False
|
||||
roles_path = /home/mg/ansible/roles
|
||||
roles_path = ~/ansible/roles
|
||||
vault_password_file = ~/ansible/vault-pass.yml
|
||||
[inventory]
|
||||
|
||||
[privilege_escalation]
|
||||
|
|
|
@ -1,25 +1,19 @@
|
|||
<s># Verschlüsseln
|
||||
ansible-vault encrypt /home/mg/ansible/inventories/group_vars/* --vault-password-file /home/mg/ansible/ansible-vault-password.yml
|
||||
# Entschlüsseln
|
||||
ansible-vault decrypt /home/mg/ansible/inventories/group_vars/* --vault-password-file /home/mg/ansible/ansible-vault-password.yml
|
||||
# Schlüssel liegt in Keepas + Datei
|
||||
- Datei ist bei .gitignore ausgenommen</s>
|
||||
# Ansible Vault + KeePass LookUp-Plugin
|
||||
|
||||
Die Secrets sind in einer KeepassDB gespeichert und werden über ein Lookup-Plugin abgerufen.
|
||||
In der DB keine Ebenen und title = Variablenname.
|
||||
# Einrichtung
|
||||
Das Plugin wird bei einer Installation mit dem Playbook "ansible" mit eingerichtet.
|
||||
|
||||
restic_repository_password: "{{ lookup('keepass', 'restic_repository_password', 'password') }}"
|
||||
Die "Secrets" liegen in der KeepassDB die mit dem Kennwort aus "vault-pass.yml" verschlüsselt ist.
|
||||
"vault-pass.yml" steht mit in der .gitignore
|
||||
Die Variable "vault_password_file" ist mit " ~/ansible/vault-pass.yml" in der ansible.cfg gesetzt.
|
||||
|
||||
# Abfrage der Secrets in tasks/playbooks
|
||||
`restic_repository_password: "{{ lookup('keepass', 'restic_repository_password', 'password') }}"`
|
||||
|
||||
Variabeln in Dictionarys vorher definieren
|
||||
## Erklärung
|
||||
```
|
||||
x = lookup
|
||||
|
||||
dict: z: x
|
||||
```
|
||||
```
|
||||
# Variable für Lookup
|
||||
lookup_var_postgres_user_and_db: "{{ lookup('keepass', 'postgres_user_and_db', 'password') }}"
|
||||
postgres_user_and_db:
|
||||
- { name_db: 'miniflux_db', name_db_user: 'miniflux_db_user', password_db_user: "{{ lookup_var_postgres_user_and_db }}" }
|
||||
restic_repository_password: <-- Ansible Variablen Name
|
||||
lookup('keepass' <-- Aufruf Keepass-Lookup-Plugin
|
||||
restic_repository_password <-- Titel Eintrag mit Secret
|
||||
password <-- Feldbzeichner in KeepassDB
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue