diff --git a/common/accounting_deployments/accounting-config.yaml b/common/accounting_deployments/accounting-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..207dbcca18eb267c342b202fe097babeb4ab29ec --- /dev/null +++ b/common/accounting_deployments/accounting-config.yaml @@ -0,0 +1,11 @@ +eosc: + tokenUrl: "{{ token_url }}" + clientId: "{{ secrets['client_id'] }}" + clientSecret: "{{ secrets['client_secret'] }}" + accountingUrl: "{{ accounting_url }}" + accountingInstallationId: "{{ secrets['accounting_install_id'] }}" + flavorMetrics: + small-environment-2-vcpu-4-gb-ram: 668bdd5988e1d617b217ecb9 + medium-environment-4-vcpu-8-gb-ram: 668bdd75d1bc0f46a16be8a2 + large-environment-8-vcpu-16-gb-ram-gpu: 668bdd8b88e1d617b217ecba + large-environment-8-vcpu-16-gb-ram: 6694d9eb744c3c7ae7531917 diff --git a/common/playbooks/accounting.yaml b/common/playbooks/accounting.yaml new file mode 100644 index 0000000000000000000000000000000000000000..182fb1905ee0d3e7f6ddc4550c706438b6798ddb --- /dev/null +++ b/common/playbooks/accounting.yaml @@ -0,0 +1,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_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 \ No newline at end of file diff --git a/staging1/accounting_deployments/accounting-config.yaml b/staging1/accounting_deployments/accounting-config.yaml new file mode 120000 index 0000000000000000000000000000000000000000..c0648412ce58cf15b0d2c098a5812cf3e0565718 --- /dev/null +++ b/staging1/accounting_deployments/accounting-config.yaml @@ -0,0 +1 @@ +../../common/accounting_deployments/accounting-config.yaml \ No newline at end of file diff --git a/staging1/inventory/99-all.yaml b/staging1/inventory/99-all.yaml index 0398c0619cc1a7f7dfdf15041cfda609a9896742..a1ea77b781a0ded7ece3cb6a3b763d717c4b2e55 100644 --- a/staging1/inventory/99-all.yaml +++ b/staging1/inventory/99-all.yaml @@ -18,3 +18,6 @@ all: notebooks_hostname: notebooks-stg1.cloud.cesnet.cz grafana_hostname: grafana-stg1.cloud.cesnet.cz + + token_url: https://proxy.staging.eosc-federation.eu/OIDC/token + accounting_url: https://api.acc.staging.eosc.grnet.gr/ \ No newline at end of file diff --git a/staging1/playbooks/accounting.yaml b/staging1/playbooks/accounting.yaml new file mode 120000 index 0000000000000000000000000000000000000000..89284849af173ceeb1d8ceeece8f76cf7be45ea9 --- /dev/null +++ b/staging1/playbooks/accounting.yaml @@ -0,0 +1 @@ +../../common/playbooks/accounting.yaml \ No newline at end of file diff --git a/staging2/accounting_deployments/accounting-config.yaml b/staging2/accounting_deployments/accounting-config.yaml new file mode 120000 index 0000000000000000000000000000000000000000..c0648412ce58cf15b0d2c098a5812cf3e0565718 --- /dev/null +++ b/staging2/accounting_deployments/accounting-config.yaml @@ -0,0 +1 @@ +../../common/accounting_deployments/accounting-config.yaml \ No newline at end of file diff --git a/staging2/inventory/99-all.yaml b/staging2/inventory/99-all.yaml index 3c59b9ce122b7c720fd13616212dc812e49a69e3..0936ff627d7c329d98ac7d46b9dd059e838615d2 100644 --- a/staging2/inventory/99-all.yaml +++ b/staging2/inventory/99-all.yaml @@ -17,3 +17,6 @@ all: notebooks_hostname: notebooks-stg2.cloud.cesnet.cz grafana_hostname: grafana-stg2.cloud.cesnet.cz + + token_url: https://proxy.staging.eosc-federation.eu/OIDC/token + accounting_url: https://api.acc.staging.eosc.grnet.gr/ \ No newline at end of file diff --git a/staging2/playbooks/accounting.yaml b/staging2/playbooks/accounting.yaml new file mode 120000 index 0000000000000000000000000000000000000000..89284849af173ceeb1d8ceeece8f76cf7be45ea9 --- /dev/null +++ b/staging2/playbooks/accounting.yaml @@ -0,0 +1 @@ +../../common/playbooks/accounting.yaml \ No newline at end of file