Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
- name: EOSC accounting deployment
hosts: master
become: true
tasks:
- name: Configure helm repo
shell: |-
helm repo add egi-accounting https://egi-federation.github.io/egi-notebooks-accounting
helm repo update
when: "'egi-accounting' not in ansible_local.helm_repos | map(attribute='name') | list"
- name: Get credentials from Vault for accounting
set_fact:
secrets: "{{ lookup('community.hashi_vault.hashi_vault', (vault_mount_point, 'accounting') | path_join,
token_validate=false) }}"
- name: Get accounting installation ID from Vault
set_fact:
secrets: "{{ secrets | combine(lookup('community.hashi_vault.hashi_vault', (vault_mount_point, 'site-' + site_name) | path_join,
token_validate=false)) }}"
- name: Debug accounting secrets
debug:
msg: "{{ item.key }} = {{ item.value }}"
loop: "{{ secrets | dict2items }}"
- name: Copy config file to master
template:
src: "../accounting_deployments/accounting-config.yaml"
dest: "/tmp/accounting-config.yaml"
mode: 0600
- name: Deploy/upgrade accounting instance
vars:
name: "notebooks-accounting"
version: "0.2.0"
shell: |-
helm status --namespace accounting {{ name }}
if [ $? -ne 0 ]; then
helm install --create-namespace --namespace accounting \
-f /tmp/accounting-config.yaml --version {{ version }} \
{{ name }} egi-accounting/notebooks-accounting
else
helm upgrade --version {{ version }} -f /tmp/accounting-config.yaml \
--namespace accounting {{ name }} egi-accounting/notebooks-accounting
fi
environment:
KUBECONFIG: /etc/kubernetes/admin.conf
PATH: /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
when: true