|
1 | 1 | --- |
2 | | -- name: Ensure temp directory exists |
3 | | - file: |
4 | | - path: "{{ loculus_temp_dir }}" |
5 | | - state: directory |
6 | | - mode: '0750' |
7 | | - |
8 | 2 | # TODO: Add nginx configuration automation for static file serving in future |
9 | 3 | # This should include adding location /static/ block to nginx config |
10 | 4 |
|
|
37 | 31 | become: yes |
38 | 32 | loop: "{{ static_images }}" |
39 | 33 |
|
| 34 | +- name: Install Helm |
| 35 | + ansible.builtin.include_role: |
| 36 | + name: gantsign.helm |
| 37 | + |
| 38 | +# Loculus deployment |
| 39 | +- name: Ensure temp directory exists |
| 40 | + file: |
| 41 | + path: "{{ loculus_temp_dir }}" |
| 42 | + state: directory |
| 43 | + mode: '0750' |
| 44 | + |
| 45 | +- name: Ensure loculus repository parent directory exists |
| 46 | + file: |
| 47 | + path: "{{ loculus_repo_path | dirname }}" |
| 48 | + state: directory |
| 49 | + mode: '0755' |
| 50 | + |
| 51 | +- name: Checkout Loculus Repository at specific commit |
| 52 | + ansible.builtin.git: |
| 53 | + repo: 'https://github.com/loculus-project/loculus.git' |
| 54 | + dest: "{{ loculus_repo_path }}" |
| 55 | + version: "{{ loculus_commit_sha }}" |
| 56 | + update: true |
| 57 | + force: true |
| 58 | + register: loculus_checkout |
| 59 | + become: yes |
| 60 | + |
| 61 | +- name: Display checked out commit |
| 62 | + debug: |
| 63 | + msg: "Loculus checked out at commit {{ loculus_commit_sha }}" |
| 64 | + |
40 | 65 | - name: Generate values file from template |
41 | 66 | template: |
42 | 67 | src: values.yaml.j2 |
43 | 68 | dest: "{{ loculus_temp_dir }}/values.yaml" |
44 | 69 | mode: '0640' |
45 | 70 |
|
46 | | -- name: Verify kubectl context is available |
47 | | - shell: kubectl config get-contexts {{ kubectl_context }} |
48 | | - register: kubectl_context_check |
49 | | - environment: |
50 | | - KUBECONFIG: "{{ loculus_kubeconfig_path }}" |
51 | | - |
52 | | -- name: Apply Helm chart with values to loculus cluster |
53 | | - shell: | |
54 | | - kubectl config use-context {{ kubectl_context }} |
55 | | - helm upgrade --install my-loculus {{ helm_chart_path }} -f {{ loculus_temp_dir }}/values.yaml |
56 | | - register: helm_output |
57 | | - environment: |
58 | | - KUBECONFIG: "{{ loculus_kubeconfig_path }}" |
59 | | - |
60 | | -- name: Display Helm output |
61 | | - debug: |
62 | | - var: helm_output.stdout_lines |
| 71 | +- name: Deploy Loculus via Helm |
| 72 | + kubernetes.core.helm: |
| 73 | + release_name: my-loculus |
| 74 | + release_namespace: loculus |
| 75 | + create_namespace: true |
| 76 | + chart_ref: "{{ loculus_helm_chart_path }}" |
| 77 | + values_files: |
| 78 | + - "{{ loculus_helm_chart_path }}/values.yaml" |
| 79 | + - "{{ loculus_temp_dir }}/values.yaml" |
| 80 | + kubeconfig: "{{ loculus_kubeconfig_path }}" |
63 | 81 |
|
64 | 82 | - name: Clean up temporary files |
65 | 83 | file: |
|
0 commit comments