Make 2 block for install & uninstall of longhorn
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
ddb9600a9d
commit
535e80804b
1 changed files with 37 additions and 38 deletions
|
|
@ -2,19 +2,9 @@
|
||||||
- name: Include file list
|
- name: Include file list
|
||||||
include_vars: "longhorn.yaml"
|
include_vars: "longhorn.yaml"
|
||||||
|
|
||||||
- name: Defined longhorn state to present
|
|
||||||
set_fact:
|
|
||||||
storage_longhorn_state: present
|
|
||||||
when:
|
|
||||||
- storage_longhorn|bool
|
|
||||||
|
|
||||||
- name: Define state of longhorn to absent
|
|
||||||
set_fact:
|
|
||||||
storage_longhorn_state: absent
|
|
||||||
when:
|
|
||||||
- not storage_longhorn|bool
|
|
||||||
|
|
||||||
- name: longhorn need to be present
|
- name: longhorn need to be present
|
||||||
|
block:
|
||||||
|
- name: Install files
|
||||||
k8s:
|
k8s:
|
||||||
state: present
|
state: present
|
||||||
context: "{{ my_context }}"
|
context: "{{ my_context }}"
|
||||||
|
|
@ -23,10 +13,29 @@
|
||||||
resource_definition: "{{ lookup('file', 'longhorn/' + item) | from_yaml }}"
|
resource_definition: "{{ lookup('file', 'longhorn/' + item) | from_yaml }}"
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ storage_longhorn_files_list }}"
|
- "{{ storage_longhorn_files_list }}"
|
||||||
|
- name: Install Ingress for longhorn UI
|
||||||
|
k8s:
|
||||||
|
state: present
|
||||||
|
context: "{{ my_context }}"
|
||||||
|
merge_type: merge
|
||||||
|
namespace: longhorn-system
|
||||||
|
resource_definition: "{{ lookup('template', 'longhorn/' + item) | from_yaml }}"
|
||||||
|
with_items:
|
||||||
|
- "longhorn_ingressroute.yaml.j2"
|
||||||
when:
|
when:
|
||||||
- storage_longhorn|bool
|
- storage_longhorn|bool
|
||||||
|
|
||||||
- name: longhorn need to be absent
|
- name: longhorn need to be absent
|
||||||
|
block:
|
||||||
|
- name: Remove Ingress for longhorn UI
|
||||||
|
k8s:
|
||||||
|
state: absent
|
||||||
|
context: "{{ my_context }}"
|
||||||
|
namespace: longhorn-system
|
||||||
|
resource_definition: "{{ lookup('template', 'longhorn/' + item) | from_yaml }}"
|
||||||
|
with_items:
|
||||||
|
- "longhorn_ingressroute.yaml.j2"
|
||||||
|
- name: Remove files
|
||||||
k8s:
|
k8s:
|
||||||
state: absent
|
state: absent
|
||||||
context: "{{ my_context }}"
|
context: "{{ my_context }}"
|
||||||
|
|
@ -37,13 +46,3 @@
|
||||||
- "{{ storage_longhorn_files_list | reverse | list }}"
|
- "{{ storage_longhorn_files_list | reverse | list }}"
|
||||||
when:
|
when:
|
||||||
- not storage_longhorn|bool
|
- not storage_longhorn|bool
|
||||||
|
|
||||||
- name: Ingress for longhorn UI need to be {{ storage_longhorn_state }}
|
|
||||||
k8s:
|
|
||||||
state: "{{ storage_longhorn_state }}"
|
|
||||||
context: "{{ my_context }}"
|
|
||||||
merge_type: merge
|
|
||||||
namespace: longhorn-system
|
|
||||||
resource_definition: "{{ lookup('template', 'longhorn/' + item) | from_yaml }}"
|
|
||||||
with_items:
|
|
||||||
- "longhorn_ingressroute.yaml.j2"
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue