Deploy longhorn with helm
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Adrien Reslinger 2021-02-01 22:16:42 +01:00
parent 857005d663
commit fdbebb2d57
Signed by: adrien
GPG key ID: DA7B27055C66D6DE
27 changed files with 46 additions and 832 deletions

View file

@ -1,48 +1,60 @@
---
- name: Include file list
include_vars: "longhorn.yaml"
- name: longhorn need to be present
block:
- name: Install files
- name: Defined longhorn repository
community.kubernetes.helm_repository:
name: longhorn
repo_url: "https://charts.longhorn.io"
- name: Deploy latest version of longhorn
community.kubernetes.helm:
context: "{{ my_context }}"
name: longhorn
chart_ref: longhorn/longhorn
# chart_version: 1.1.0
create_namespace: yes
release_namespace: "{{ storage_longhorn_namespace }}"
values:
defaultSettings:
defaultDataPath: "/var/lib/longhorn/"
- name: Install longhorn UI Ingress
k8s:
state: present
context: "{{ my_context }}"
merge_type: merge
namespace: longhorn-system
resource_definition: "{{ lookup('file', 'longhorn/' + item) | from_yaml }}"
with_items:
- "{{ storage_longhorn_files_list }}"
- name: Install Ingress for longhorn UI
k8s:
state: present
context: "{{ my_context }}"
merge_type: merge
namespace: longhorn-system
namespace: "{{ storage_longhorn_namespace }}"
resource_definition: "{{ lookup('template', 'longhorn/' + item) | from_yaml }}"
with_items:
- "longhorn_ingressroute.yaml.j2"
when:
- storage_longhorn|bool
tags:
- longhorn
- storage
- name: longhorn need to be absent
block:
- name: Deploy latest version of longhorn
community.kubernetes.helm:
context: "{{ my_context }}"
name: longhorn
chart_ref: longhorn/longhorn
# chart_version: 1.1.0
release_state: absent
release_namespace: "{{ storage_longhorn_namespace }}"
values:
defaultSettings:
defaultDataPath: "/var/lib/longhorn/"
- name: Remove Ingress for longhorn UI
k8s:
state: absent
context: "{{ my_context }}"
namespace: longhorn-system
namespace: "{{ storage_longhorn_namespace }}"
resource_definition: "{{ lookup('template', 'longhorn/' + item) | from_yaml }}"
with_items:
- "longhorn_ingressroute.yaml.j2"
- name: Remove files
k8s:
state: absent
context: "{{ my_context }}"
merge_type: merge
namespace: longhorn-system
resource_definition: "{{ lookup('file', 'longhorn/' + item) | from_yaml }}"
with_items:
- "{{ storage_longhorn_files_list | reverse | list }}"
- "longhorn-namespace.yml.j2"
when:
- not storage_longhorn|bool
tags:
- longhorn
- storage