-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathplaybook_nfs_helm_sc.yml
51 lines (43 loc) · 1.65 KB
/
playbook_nfs_helm_sc.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
# put MetalLB as peer on host network
- hosts: localhost
connection: local
tasks:
- set_fact:
nfs_server_ip: "{{ ansible_default_ipv4.address }}"
- hosts: master
gather_facts: yes
become: yes
become_user: ubuntu
tasks:
# helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner
# https://docs.ansible.com/ansible/latest/collections/kubernetes/core/helm_module.html#ansible-collections-kubernetes-core-helm-module
- name: Add nfs subdir helm3 repo
kubernetes.core.helm_repository:
name: nfs-subdir-external-provisioner
repo_url: https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner
#helm install nfs-subdir-external-provisioner \
#nfs-subdir-external-provisioner/nfs-subdir-external-provisioner \
#--set nfs.server=<IP> \
#--set nfs.path=/data/nfs1 \
#--set storageClass.onDelete=true
- name: Deploy nfs subdir provisioner
kubernetes.core.helm:
name: nfs-subdir-external-provisioner
chart_ref: nfs-subdir-external-provisioner/nfs-subdir-external-provisioner
wait: false
values:
nfs:
server: "{{ hostvars['localhost'].nfs_server_ip }}"
path: /data/nfs1
storageClass:
onDelete: true
release_namespace: default
create_namespace: false
# https://docs.ansible.com/ansible/latest/collections/kubernetes/core/k8s_info_module.html
- name: validate storageclass
kubernetes.core.k8s_info:
api_version: storage.k8s.io/v1
kind: StorageClass
register: sc_list
- debug: msg="{{sc_list}}"