Deploy local-path with helm
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
fdbebb2d57
commit
74333953a8
18 changed files with 211 additions and 224 deletions
71
tasks/local-path.yml
Normal file
71
tasks/local-path.yml
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
---
|
||||
- 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
|
||||
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 }}
|
||||
k8s:
|
||||
state: "{{ storage_localpath_state }}"
|
||||
context: "{{ my_context }}"
|
||||
namespace: "{{ storage_localpath_namespace }}"
|
||||
merge_type: merge
|
||||
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
|
||||
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
|
||||
|
||||
- name: Deploy local-path chart from local path
|
||||
community.kubernetes.helm:
|
||||
state: "{{ storage_localpath_state }}"
|
||||
name: local-path-provisioner
|
||||
context: "{{ my_context }}"
|
||||
chart_ref: tmp/local-path-provisioner/deploy/chart
|
||||
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: [/mnt/local]
|
||||
tags:
|
||||
- storage
|
||||
- local-path
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
---
|
||||
- name: Include file list
|
||||
include_vars: "local.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: local-path-storage need to be {{ storage_localpath_state }}
|
||||
k8s:
|
||||
state: "{{ storage_localpath_state }}"
|
||||
context: "{{ my_context }}"
|
||||
merge_type: merge
|
||||
resource_definition: "{{ lookup('file', 'local/' + item) | from_yaml }}"
|
||||
with_items:
|
||||
- "{{ storage_localpath_files_list }}"
|
||||
|
|
@ -1,12 +1,41 @@
|
|||
- name: Local Path setup
|
||||
block:
|
||||
# - include_tasks: "manual.yml"
|
||||
- include_tasks: "local.yml"
|
||||
- name: Define Manual StorageClass
|
||||
k8s:
|
||||
state: present
|
||||
context: "{{ my_context }}"
|
||||
definition:
|
||||
kind: StorageClass
|
||||
apiVersion: storage.k8s.io/v1
|
||||
metadata:
|
||||
name: manual
|
||||
provisioner: kubernetes.io/no-provisioner
|
||||
volumeBindingMode: WaitForFirstConsumer
|
||||
when:
|
||||
- storage_manual|bool
|
||||
tags:
|
||||
- manual
|
||||
- storage
|
||||
|
||||
- include_tasks: "local-path.yml"
|
||||
tags:
|
||||
- local-path
|
||||
- storage
|
||||
- include_tasks: "longhorn.yml"
|
||||
tags:
|
||||
- longhorn
|
||||
- storage
|
||||
- include_tasks: "nfs.yml"
|
||||
tags:
|
||||
- nfs
|
||||
- storage
|
||||
|
||||
# https://medium.com/asl19-developers/create-readwritemany-persistentvolumeclaims-on-your-kubernetes-cluster-3a8db51f98e3
|
||||
# https://github.com/ctrox/csi-s3
|
||||
# https://github.com/kahing/goofys
|
||||
# https://github.com/reactr-io/gocachefs
|
||||
|
||||
|
||||
- include_tasks: "digital_ocean.yml"
|
||||
- include_tasks: "linode.yml"
|
||||
- include_tasks: "secrets-store.yml"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue