diff --git a/common/playbooks/security-assets.yaml b/common/playbooks/security-assets.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0ae2fe87f35a37d2d3893817baf7af4cb7fe8c18 --- /dev/null +++ b/common/playbooks/security-assets.yaml @@ -0,0 +1,40 @@ +--- +# +# Secrets in "/glpi-agent": +# +# * server (or local) +# * user +# * password +# * tag +# +- name: GLPI Agent Configuration + hosts: allnodes + become: true + tasks: + - name: Get Secrets From Vault + set_fact: + secret: "{{ lookup('community.hashi_vault.hashi_vault', vault_mount_point + '/glpi-agent', token_validate=false) }}" + - name: Debug Secrets + debug: + msg: "{{ item.key }} = {{ item.value }}" + loop: "{{ secret | dict2items }}" + - name: Directory for for GLPI agent configuration + file: + path: /etc/glpi-agent/conf.d + state: directory + mode: 0755 + - name: Configuration For GLPI Agent + template: + src: "templates/{{ item }}.j2" + dest: "{{ item }}" + mode: 0600 + loop: + - /etc/glpi-agent/conf.d/01-eosc.cfg + +- name: GLPI Agent Deployment + hosts: allnodes + roles: + - role: 'ipr-cnrs.glpi_agent' + vars: + glpi_agent__install_from_url: true + glpi_agent__version: '1.10-1' 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 new file mode 100644 index 0000000000000000000000000000000000000000..49dc79c7575a125f0b3fb2f79411338e608d1999 --- /dev/null +++ b/common/playbooks/templates/etc/glpi-agent/conf.d/01-eosc.cfg.j2 @@ -0,0 +1,7 @@ +{{ ansible_managed | comment }} + +{% for key, value in secret.items() -%} +{% if value|length -%} +{{ key }} = {{ value }} +{% endif -%} +{% endfor -%} diff --git a/requirements.yml b/requirements.yml index afe4528a5cd58438bc0468c9d368cbd14c2ff1bd..9e77ef3a8df023d107ca14bdb97d322ed02ff318 100644 --- a/requirements.yml +++ b/requirements.yml @@ -6,3 +6,4 @@ collections: - community.hashi_vault roles: - grycap.kubernetes + - ipr-cnrs.glpi_agent diff --git a/staging1/deploy.sh b/staging1/deploy.sh index feba19642712a4437b6eb5e48ae90245a6215dc0..68cffd8c70a88a1902f6b19c8a451f02a411ec9b 100755 --- a/staging1/deploy.sh +++ b/staging1/deploy.sh @@ -53,3 +53,5 @@ ansible-playbook playbooks/cvmfs.yaml # wait for finish while ansible -m command -a 'kubectl get pods --all-namespaces' master | tail -n +3 | grep -v ' Running '; do sleep 5; done + +ansible-playbook playbooks/security-assets.yaml diff --git a/staging1/playbooks/security-assets.yaml b/staging1/playbooks/security-assets.yaml new file mode 120000 index 0000000000000000000000000000000000000000..6bc815588ddaedf9804046b74ba0cb4aeb8e8d5c --- /dev/null +++ b/staging1/playbooks/security-assets.yaml @@ -0,0 +1 @@ +../../common/playbooks/security-assets.yaml \ No newline at end of file diff --git a/staging1/playbooks/templates/etc/glpi-agent b/staging1/playbooks/templates/etc/glpi-agent new file mode 120000 index 0000000000000000000000000000000000000000..dfa13f5fb7b14f381988b7b44a093d4acf7f501f --- /dev/null +++ b/staging1/playbooks/templates/etc/glpi-agent @@ -0,0 +1 @@ +../../../../common/playbooks/templates/etc/glpi-agent \ No newline at end of file