forked from cedadev/jasmin-appliances
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpangeo-infra.yml
79 lines (70 loc) · 2.64 KB
/
pangeo-infra.yml
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
#####
## Playbook that provisions and then configures a Kubernetes
## cluster on OpenStack before installing the Pangeo stack
#####
# Reuse Kubernetes playbook to create a cluster
- import_playbook: k8s-infra.yml
# Create a FreeIPA group for the notebook users
- hosts: freeipa_servers
become: true
tasks:
- set_fact:
pangeo_notebook_users_group: "{{ cluster_name | lower | replace('-', '_') }}_notebook_users"
- name: Create notebook users group
ipa_group:
cn: "{{ pangeo_notebook_users_group }}"
description: "Notebook users for Pangeo cluster '{{ cluster_name }}'"
# If deleting the cluster, also delete the group
state: "{{ cluster_state | default('present') }}"
ipa_host: "{{ ansible_fqdn }}"
ipa_pass: "{{ freeipa_admin_password }}"
# Helm will have been installed on the first host in the cluster
- hosts: "{{ groups.get('rke_hosts', []) | first | default('!all') }}"
become: true
pre_tasks:
# Create persistent secrets for Pangeo
- name: Generate Pangeo secrets
include_tasks: tasks/util/persistent_random_fact.yml
vars:
fact_name: "{{ item }}"
random_fact_bytes: 32
loop:
- pangeo_secret_token
- pangeo_dask_gateway_api_token
tasks:
# Detect the chart used by the existing Pangeo installation
- name: Detect chart for pangeo release
shell: helm list --all-namespaces | grep -e "^pangeo" | awk '{ print $9; }' | awk -F"-" '{ print $1; }'
changed_when: false
register: pangeo_current_chart_cmd
- name: Set pangeo current chart fact
set_fact:
pangeo_current_chart: "{{ pangeo_current_chart_cmd.stdout }}"
- name: Remove legacy Pangeo installation
include_role:
name: jasmin.helm
tasks_from: chart.yml
vars:
helm_release_name: pangeo
helm_release_namespace: pangeo
helm_release_state: absent
when:
- pangeo_current_chart is defined
- pangeo_current_chart == "pangeo"
# Install the Dask repo
- name: Install Dask Helm repository
command: helm repo add --force-update dask https://helm.dask.org/
# Set facts that we need for the Helm chart
- set_fact:
pangeo_notebook_users_group: "{{ hostvars[groups.freeipa_servers | first].pangeo_notebook_users_group }}"
# Install the Pangeo chart
- include_role:
name: jasmin.helm
tasks_from: chart.yml
vars:
helm_release_name: pangeo
helm_release_chart: dask/daskhub
helm_release_version: "4.5.6"
helm_release_namespace: pangeo
helm_release_values_template: templates/helm/pangeo.yml