fix automouting of gluster mounts on home

This commit is contained in:
2022-10-05 18:44:44 -04:00
parent 58f00230a3
commit 10dbe924ad
9 changed files with 119 additions and 22 deletions

View File

@@ -21,10 +21,10 @@ volumes:
brick_folder: brick brick_folder: brick
# bricks found at "{{mounts.paths[gitea]}}/{{volumes.brick_folder}}" # bricks found at "{{mounts.paths[gitea]}}/{{volumes.brick_folder}}"
replicated: replicated:
# - name: gitea - name: gitea
# - name: jenkins # - name: jenkins
# - name: vmshares # - name: vmshares
# - name: mariadb - name: mariadb
- name: plex - name: plex
# - name: nextcloud2 # - name: nextcloud2
# - name: prometheus # - name: prometheus

View File

@@ -5,24 +5,21 @@ 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 - name: plex
path: "/opt/data/plex" path: "/opt/data/plex"
state: mounted 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: "/opt/data/gitea"
# state: present state: mounted
# - 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
helm: helm:
repos: repos:
@@ -41,3 +38,5 @@ apps:
stash: stash:
state: present state: present
namespace: stashapp namespace: stashapp
mariadb:
namespace: mariadb

View File

@@ -0,0 +1,13 @@
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: "{{apps.mariadb.namespace}}"
namespace: mariadb
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi

View File

@@ -0,0 +1,17 @@
---
# persistent volume
apiVersion: v1
kind: PersistentVolume
metadata:
name: mariadb-pv-local
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 100Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/opt/mariadb"

View File

@@ -0,0 +1,17 @@
---
# mariadb values file
secondary:
replicaCount: 0
image:
# repository: mariadb
# tag: 10.5
auth:
rootPassword: "aifuoqibcqobcqb3"
# existingSecret: ''
#primary:
# persistence:
# existingClaim: mariadb-pv-claim

View File

@@ -0,0 +1,51 @@
---
#https://github.com/bitnami/charts/tree/master/bitnami/mariadb
- name: "todo: deploy mariadb"
debug:
msg: "TODO: write deployment tasks"
- name: Create a namespace for mariadb
k8s:
kubeconfig: "/etc/rancher/k3s/k3s.yaml"
name: mariadb
api_version: v1
kind: Namespace
state: present
become: true
- name: create persistent volume resources
kubernetes.core.k8s:
kubeconfig: "/etc/rancher/k3s/k3s.yaml"
state: present
definition: "{{ lookup('template', item) | from_yaml }}"
loop:
- mariadb/pv.yaml
- mariadb/pv-claim.yaml
become: true
- name: Install mariadb globally available
block:
- name: Add mariadb chart helm repo
local_action:
module: kubernetes.core.helm_repository
name: bitnami
repo_url: https://charts.bitnami.com/bitnami
- name: load variables files/mariadb/values.yaml
ansible.builtin.include_vars:
file: files/mariadb/values.yaml
name: stash_values
- name: Install mariadb Release
local_action:
module: kubernetes.core.helm
release_state: present
name: "{{apps.mariadb.namespace}}"
namespace: mariadb
create_namespace: yes
update_repo_cache: True
chart_ref: bitnami/mariadb
values: "{{stash_values}}"
wait: true

View File

@@ -7,7 +7,7 @@
path: "{{item.path}}" path: "{{item.path}}"
src: "gluster:/{{item.name}}" src: "gluster:/{{item.name}}"
fstype: "glusterfs" fstype: "glusterfs"
boot: false boot: true
opts: "direct-io-mode=disable,_netdev,x-systemd.automount 0 0" opts: "direct-io-mode=disable,_netdev,x-systemd.automount 0 0"
state: "{{item.state}}" state: "{{item.state}}"
with_items: "{{fstab.gluster}}" with_items: "{{fstab.gluster}}"

View File

@@ -2,18 +2,22 @@
# 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 ## add helm repositories
#- include_tasks: add_repos.yml #- include_tasks: add_repos.yml
# #
#- include_tasks: cert_manager.yml - name: deploy cert_manager
# include_tasks: cert_manager.yml
#- include_tasks: hello-world.yaml
- include_tasks: deployments/stash.yaml - name: deploy hello-world
include_tasks: hello-world.yaml
- include_tasks: deployments/argoCD.yaml - name: deploy stash
include_tasks: deployments/stash.yaml
#- name: deploy mariadb
# include_tasks: deployments/mariadb.yaml
#----------------------------------------------------- #-----------------------------------------------------

View File

@@ -1,4 +0,0 @@
---
#https://github.com/bitnami/charts/tree/master/bitnami/mariadb