diff --git a/common/playbooks/security-assets.yaml b/common/playbooks/security-assets.yaml index 0ae2fe87f35a37d2d3893817baf7af4cb7fe8c18..bd551420de21ecfffe4ee19ff60434d34882a581 100644 --- a/common/playbooks/security-assets.yaml +++ b/common/playbooks/security-assets.yaml @@ -1,11 +1,16 @@ --- # -# Secrets in "/glpi-agent": +# Secrets in "/{{ site_name }}": # -# * server (or local) -# * user -# * password -# * tag +# Anything starting "glpi_" will be propagated to the confiugration. +# +# Expected secrets: +# +# * glpi_local (for debugging) +# * glpi_server (for remote assets management integration) +# * glpi_user +# * glpi_password +# * glpi_tag # - name: GLPI Agent Configuration hosts: allnodes @@ -13,7 +18,7 @@ tasks: - name: Get Secrets From Vault set_fact: - secret: "{{ lookup('community.hashi_vault.hashi_vault', vault_mount_point + '/glpi-agent', token_validate=false) }}" + secret: "{{ lookup('community.hashi_vault.hashi_vault', vault_mount_point + '/site-' + site_name, token_validate=false) }}" - name: Debug Secrets debug: msg: "{{ item.key }} = {{ item.value }}" diff --git a/common/playbooks/templates/etc/glpi-agent/conf.d/01-eosc.cfg.j2 b/common/playbooks/templates/etc/glpi-agent/conf.d/01-eosc.cfg.j2 index 49dc79c7575a125f0b3fb2f79411338e608d1999..87a8d42939ec414115b7a2a469764cbe0b5e37cd 100644 --- a/common/playbooks/templates/etc/glpi-agent/conf.d/01-eosc.cfg.j2 +++ b/common/playbooks/templates/etc/glpi-agent/conf.d/01-eosc.cfg.j2 @@ -1,7 +1,7 @@ {{ ansible_managed | comment }} {% for key, value in secret.items() -%} -{% if value|length -%} -{{ key }} = {{ value }} +{% if key | regex_search('^glpi_') -%} +{{ key | regex_replace('^glpi_', '') }} = {{ value }} {% endif -%} {% endfor -%}