Big update af the role
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Adrien Reslinger 2022-03-03 12:06:46 +01:00
parent 10f4eb6ef0
commit d97acb68b0
Signed by: adrien
GPG key ID: DA7B27055C66D6DE
14 changed files with 156 additions and 246 deletions

View file

@ -1,72 +1,51 @@
---
- name: Local-path
block:
- name: Include file list
include_vars: "local-path.yaml"
- name: Defined local-path-storage state to present
set_fact:
storage_localpath_state: present
when:
- storage_localpath|bool
- name: find state of local-path-storage
set_fact:
storage_localpath_state: absent
when:
- not storage_localpath|bool
# - name: namespace
# kubernetes.core.k8s:
# state: present
# context: "{{ my_context }}"
# merge_type: merge
# definition:
# api_version: v1
# kind: Namespace
# metadata:
# name: "{{ storage_localpath_namespace }}"
# labels:
# namespace: '{{ storage_localpath_namespace }}'
# when:
# - storage_localpath|bool
#
# - name: local-path-storage need to be {{ storage_localpath_state }}
# kubernetes.core.k8s:
# state: "{{ storage_localpath_state }}"
# context: "{{ my_context }}"
# namespace: "{{ storage_localpath_namespace }}"
# apply: true
# resource_definition: "{{ lookup('file', 'local-path/' + item) | from_yaml }}"
# with_items:
# - "{{ storage_localpath_files_list }}"
# https://github.com/rancher/local-path-provisioner/tree/master/deploy/chart
- name: Downloal Local-path repository
- name: Install Local-path
block:
- name: Git clone stable repo on HEAD
ansible.builtin.git:
repo: "https://github.com/rancher/local-path-provisioner.git"
dest: tmp/local-path-provisioner
version: "{{ storage_localpath_version }}"
version: "{{ storage_localpath.version }}"
- name: Deploy local-path chart from local path
kubernetes.core.helm:
state: "{{ storage_localpath_state }}"
state: "present"
name: local-path-provisioner
context: "{{ my_context }}"
chart_ref: tmp/local-path-provisioner/deploy/chart
release_namespace: "{{ storage_localpath_namespace }}"
release_namespace: "{{ storage_localpath.namespace }}"
create_namespace: true
values:
# rbac:
# create: false
# serviceAccount:
# create: false
# name: local-path-provisioner
nodePathMap:
- node: DEFAULT_PATH_FOR_NON_LISTED_NODES
paths: ["{{ storage_localpath_default_path }}"]
paths: ["{{ storage_localpath.default_path }}"]
when:
- storage_localpath.enabled
- name: Uninstall Local-path
block:
- name: Uninstall local-path
kubernetes.core.helm:
context: "{{ my_context }}"
name: local-path-provisioner
release_state: absent
release_namespace: "{{ storage_localpath.namespace }}"
- name: namespace
kubernetes.core.k8s:
state: absent
context: "{{ my_context }}"
namespace: "{{ storage_localpath.namespace }}"
resource_definition: "{{ lookup('template', 'local-path/' + item) | from_yaml }}"
with_items:
- "local-path-namespace.yml.j2"
when:
- not storage_localpath.enabled
tags:
- storage
- local-path