Use persistent volume claim with stash
This commit is contained in:
@@ -1,18 +1,25 @@
|
|||||||
---
|
---
|
||||||
# default values for prod.k3s
|
# default values for prod.k3s
|
||||||
|
kube_context: home
|
||||||
|
|
||||||
fstab:
|
fstab:
|
||||||
gluster:
|
gluster:
|
||||||
#state can be present, mounted, absent, unmounted, remounted
|
#state can be present, mounted, absent, unmounted, remounted
|
||||||
|
- name: plex
|
||||||
|
path: "/var/lib/plex"
|
||||||
|
state: absent
|
||||||
|
- name: plex
|
||||||
|
path: "/opt/data/plex"
|
||||||
|
state: mounted
|
||||||
# - name: jenkins
|
# - name: jenkins
|
||||||
# path: "/var/lib/jenkins"
|
# path: "/var/lib/jenkins"
|
||||||
# state: mounted
|
# state: mounted
|
||||||
- name: gitea
|
# - name: gitea
|
||||||
path: "/var/lib/gitea"
|
# path: "/var/lib/gitea"
|
||||||
state: present
|
# state: present
|
||||||
- name: vmshares
|
# - name: vmshares
|
||||||
path: "/opt/shared"
|
# path: "/opt/shared"
|
||||||
state: mounted
|
# state: mounted
|
||||||
# - name: mariadb
|
# - name: mariadb
|
||||||
# path: "/opt/mariadb"
|
# path: "/opt/mariadb"
|
||||||
# state: mounted
|
# state: mounted
|
||||||
|
|||||||
13
ansible-5/roles/prod.k3s/files/stash/pv-claim.yaml
Normal file
13
ansible-5/roles/prod.k3s/files/stash/pv-claim.yaml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: stash-pv-claim
|
||||||
|
namespace: testing
|
||||||
|
spec:
|
||||||
|
storageClassName: manual
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 10Gi
|
||||||
17
ansible-5/roles/prod.k3s/files/stash/pv.yaml
Normal file
17
ansible-5/roles/prod.k3s/files/stash/pv.yaml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
# persistent volume
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: plex-pv-local
|
||||||
|
labels:
|
||||||
|
type: local
|
||||||
|
spec:
|
||||||
|
storageClassName: manual
|
||||||
|
capacity:
|
||||||
|
storage: 100Gi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
hostPath:
|
||||||
|
path: "/opt/data/plex"
|
||||||
|
|
||||||
14
ansible-5/roles/prod.k3s/files/stash/values.yaml
Normal file
14
ansible-5/roles/prod.k3s/files/stash/values.yaml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
#values file for stash deployment
|
||||||
|
|
||||||
|
ingress:
|
||||||
|
main:
|
||||||
|
enabled: true
|
||||||
|
hosts:
|
||||||
|
- host: stash.xai-corp.net
|
||||||
|
paths:
|
||||||
|
- path: /opt/stash
|
||||||
|
persistence:
|
||||||
|
config:
|
||||||
|
enabled: true
|
||||||
|
existingClaim: stash-pv-claim
|
||||||
47
ansible-5/roles/prod.k3s/tasks/deployments/stash.yaml
Normal file
47
ansible-5/roles/prod.k3s/tasks/deployments/stash.yaml
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
---
|
||||||
|
# stash media manager
|
||||||
|
|
||||||
|
# helm should be run from local environment
|
||||||
|
- name: check we can access the cluster
|
||||||
|
local_action:
|
||||||
|
module: kubernetes.core.helm_info
|
||||||
|
# kubeconfig: "/etc/rancher/k3s/k3s.yaml"
|
||||||
|
context: "{{kube_context}}"
|
||||||
|
name: test
|
||||||
|
release_namespace: kube-system
|
||||||
|
# release_state: all
|
||||||
|
register: default_namespace
|
||||||
|
|
||||||
|
- name: create persistent volume resources
|
||||||
|
kubernetes.core.k8s:
|
||||||
|
kubeconfig: "/etc/rancher/k3s/k3s.yaml"
|
||||||
|
state: present
|
||||||
|
definition: "{{ lookup('file', item) | from_yaml }}"
|
||||||
|
loop:
|
||||||
|
- stash/pv.yaml
|
||||||
|
- stash/pv-claim.yaml
|
||||||
|
become: true
|
||||||
|
|
||||||
|
- name: Add stash chart helm repo
|
||||||
|
local_action:
|
||||||
|
module: kubernetes.core.helm_repository
|
||||||
|
name: k8s-at-home
|
||||||
|
repo_url: https://k8s-at-home.com/charts/
|
||||||
|
|
||||||
|
- name: load variables files/stash/values.yaml
|
||||||
|
ansible.builtin.include_vars:
|
||||||
|
file: files/stash/values.yaml
|
||||||
|
name: stash_values
|
||||||
|
|
||||||
|
- name: Install stash Chart
|
||||||
|
local_action:
|
||||||
|
module: kubernetes.core.helm
|
||||||
|
release_state: present
|
||||||
|
name: stash
|
||||||
|
namespace: testing
|
||||||
|
create_namespace: yes
|
||||||
|
update_repo_cache: True
|
||||||
|
chart_ref: k8s-at-home/stash
|
||||||
|
values: "{{stash_values}}"
|
||||||
|
wait: true
|
||||||
|
|
||||||
@@ -2,14 +2,16 @@
|
|||||||
# provisioning services in k3s cluster
|
# provisioning services in k3s cluster
|
||||||
|
|
||||||
# mount gluster
|
# mount gluster
|
||||||
- include_tasks: gluster.fstab.yml
|
#- include_tasks: gluster.fstab.yml
|
||||||
|
#
|
||||||
|
## add helm repositories
|
||||||
|
#- include_tasks: add_repos.yml
|
||||||
|
#
|
||||||
|
#- include_tasks: cert_manager.yml
|
||||||
|
#
|
||||||
|
#- include_tasks: hello-world.yaml
|
||||||
|
|
||||||
# add helm repositories
|
- include_tasks: deployments/stash.yaml
|
||||||
- include_tasks: add_repos.yml
|
|
||||||
|
|
||||||
- include_tasks: cert_manager.yml
|
|
||||||
|
|
||||||
- include_tasks: hello-world.yaml
|
|
||||||
|
|
||||||
#- include_tasks: mariadb.yaml
|
#- include_tasks: mariadb.yaml
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user