Contains: - Production inventory (inventories/production/hosts) - VictoriaMetrics installation (playbooks/monitoring/install_victoriametrics.yml) - Vault setup and secrets management (playbooks/vault/) - Base system configuration (playbooks/infrastructure/) - Directory structure for monitoring components
79 lines
2.4 KiB
YAML
79 lines
2.4 KiB
YAML
---
|
|
- name: Test Vault Integration with CORRECT paths
|
|
hosts: localhost
|
|
connection: local
|
|
gather_facts: no
|
|
|
|
vars:
|
|
vault_addr: "http://192.168.0.103:8200"
|
|
vault_token: "hvs.DhQx1U9igYhLfoUHIGtLgqs8"
|
|
|
|
tasks:
|
|
- name: Test 1 - Read Git secret from Vault
|
|
uri:
|
|
url: "{{ vault_addr }}/v1/secret/data/git/forgejo"
|
|
method: GET
|
|
headers:
|
|
X-Vault-Token: "{{ vault_token }}"
|
|
return_content: yes
|
|
validate_certs: no
|
|
register: git_secret
|
|
|
|
- name: Display Git credentials
|
|
debug:
|
|
msg: |
|
|
Git Forgejo Credentials:
|
|
URL: {{ (git_secret.content | from_json).data.data.url }}
|
|
User: {{ (git_secret.content | from_json).data.data.user }}
|
|
Password: {{ (git_secret.content | from_json).data.data.password }}
|
|
|
|
- name: Test 2 - Create VictoriaMetrics secret
|
|
uri:
|
|
url: "{{ vault_addr }}/v1/secret/data/monitoring/victoriametrics"
|
|
method: POST
|
|
headers:
|
|
X-Vault-Token: "{{ vault_token }}"
|
|
Content-Type: application/json
|
|
body_format: json
|
|
body:
|
|
data:
|
|
host: "192.168.0.104"
|
|
port: "8428"
|
|
url: "http://192.168.0.104:8428"
|
|
retention_days: "30"
|
|
validate_certs: no
|
|
register: create_vm_secret
|
|
|
|
- name: Test 3 - Read VictoriaMetrics secret
|
|
uri:
|
|
url: "{{ vault_addr }}/v1/secret/data/monitoring/victoriametrics"
|
|
method: GET
|
|
headers:
|
|
X-Vault-Token: "{{ vault_token }}"
|
|
return_content: yes
|
|
validate_certs: no
|
|
register: vm_secret
|
|
|
|
- name: Display VictoriaMetrics configuration
|
|
debug:
|
|
msg: |
|
|
VictoriaMetrics (Container 119):
|
|
Host: {{ (vm_secret.content | from_json).data.data.host }}
|
|
Port: {{ (vm_secret.content | from_json).data.data.port }}
|
|
URL: {{ (vm_secret.content | from_json).data.data.url }}
|
|
Retention: {{ (vm_secret.content | from_json).data.data.retention_days }} days
|
|
|
|
- name: Test 4 - List all secrets
|
|
uri:
|
|
url: "{{ vault_addr }}/v1/secret/metadata"
|
|
method: LIST
|
|
headers:
|
|
X-Vault-Token: "{{ vault_token }}"
|
|
return_content: yes
|
|
validate_certs: no
|
|
register: secrets_list
|
|
|
|
- name: Display secrets structure
|
|
debug:
|
|
msg: "Secrets in Vault: {{ (secrets_list.content | from_json).data.keys }}"
|