update
parent
9823945312
commit
c27b52d16a
|
|
@ -3,7 +3,16 @@
|
|||
name: "HostPath"
|
||||
roles:
|
||||
- role: hostpath
|
||||
---
|
||||
|
||||
- hosts: all
|
||||
name: "Install nfs package"
|
||||
tasks:
|
||||
- name: install common packages
|
||||
become: yes
|
||||
apt:
|
||||
pkg: nfs-common
|
||||
update_cache: yes
|
||||
|
||||
- hosts: control-plane
|
||||
name: "NFS"
|
||||
roles:
|
||||
|
|
|
|||
|
|
@ -1,29 +1,3 @@
|
|||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: nginx-pv
|
||||
spec:
|
||||
storageClassName: ""
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
capacity:
|
||||
storage: 1Gi
|
||||
nfs:
|
||||
server: 10.100.10.10
|
||||
path: /share
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: nginx-pvc
|
||||
spec:
|
||||
storageClassName: ""
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
|
|
@ -46,12 +20,12 @@ spec:
|
|||
ports:
|
||||
- containerPort: 80
|
||||
volumeMounts:
|
||||
- mountPath: /var/www
|
||||
name: nginx-pv
|
||||
- mountPath: /usr/share/nginx/html/
|
||||
name: nfs-pv
|
||||
volumes:
|
||||
- name: nginx-pv
|
||||
- name: nfs-pv
|
||||
persistentVolumeClaim:
|
||||
claimName: nginx-pvc
|
||||
claimName: nfs-pvc
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
|
|
|
|||
|
|
@ -10,4 +10,5 @@
|
|||
copy:
|
||||
src: index.html
|
||||
dest: /data/
|
||||
mode: '0755'
|
||||
when: "'K8s-worker-node2' in ansible_facts.hostname"
|
||||
|
|
|
|||
|
|
@ -13,22 +13,16 @@
|
|||
|
||||
- name: template every yaml.j2 files
|
||||
template:
|
||||
src: "{{item}}.j2"
|
||||
dest: "/tmp/nfs-server/{{item}}"
|
||||
with_items:
|
||||
- nfs-pv-pvc.yaml
|
||||
- nfs-server-deployment-service.yaml
|
||||
- nfs-dep-sc.yaml
|
||||
src: "nfs-pv-pvc.yaml.j2"
|
||||
dest: "/tmp/nfs-server/nfs-pv-pvc.yaml"
|
||||
|
||||
- name: kubectl apply
|
||||
shell: |
|
||||
kubectl apply -f nfs-pv-pvc.yaml
|
||||
# kubectl apply -f nfs-dep-sc.yaml
|
||||
# kubectl apply -f nfs-server-deployment-service.yaml
|
||||
register: output
|
||||
args:
|
||||
chdir: /tmp/nfs-server
|
||||
|
||||
- name: Print return information from the previous task
|
||||
- name: Resultat de kubectl
|
||||
debug:
|
||||
var: output.stdout
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
- import_playbook: flannel.yaml
|
||||
- import_playbook: pre-join.yaml
|
||||
- import_playbook: kubernetes-worker.yaml
|
||||
- import_playbook: openebs.yaml
|
||||
#- import_playbook: openebs.yaml
|
||||
- import_playbook: ingress-nginx.yaml
|
||||
- import_playbook: purelb.yaml
|
||||
#- import_playbook: metallb.yaml
|
||||
|
|
|
|||
Loading…
Reference in New Issue