main.yml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. # Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. ---
  15. - name: Helm - add JupyterHub repo
  16. command: "helm repo add jupyterhub '{{ jupyterhub_helm_chart_repo }}'"
  17. changed_when: true
  18. - name: Helm - update repo
  19. command: helm repo update
  20. changed_when: true
  21. - name: Copy JupyterHub custom config file
  22. copy:
  23. src: jupyter_config.yaml
  24. dest: "{{ jupyter_config_file_dest }}"
  25. owner: root
  26. group: root
  27. mode: "{{ jupyter_config_file_mode }}"
  28. - name: JupyterHub deploy
  29. block:
  30. - name: JupyterHub deploy
  31. command: >
  32. helm upgrade --cleanup-on-fail \
  33. --install {{ jupyterhub_namespace }} jupyterhub/jupyterhub \
  34. --namespace {{ jupyterhub_namespace }} \
  35. --create-namespace \
  36. --version {{ helm_chart_version }} \
  37. --values {{ jupyter_config_file_dest }} \
  38. --timeout {{ timeout_min_sec }}
  39. register: deployment_output
  40. rescue:
  41. - name: JupyterHub deployment error
  42. debug:
  43. msg: "Previous JupyterHub deployment is in progress"
  44. when: "'another operation (install/upgrade/rollback) is in progress' in deployment_output.stderr"
  45. - name: Delete existing release
  46. command: helm delete '{{ jupyterhub_namespace }}'
  47. - name: JupyterHub deploy
  48. command: >
  49. helm upgrade --cleanup-on-fail \
  50. --install {{ jupyterhub_namespace }} jupyterhub/jupyterhub \
  51. --namespace {{ jupyterhub_namespace }} \
  52. --create-namespace \
  53. --version {{ helm_chart_version }} \
  54. --values {{ jupyter_config_file_dest }} \
  55. --timeout {{ timeout_min_sec }}