Helper to transfer data to CephFs and setup wikis

This commit is contained in:
Paul-Henri Froidmont 2019-09-01 03:41:21 +02:00
parent 80321d5ec9
commit d77f2ef548
10 changed files with 163 additions and 39 deletions

View file

@ -2,5 +2,4 @@
letsencrypt_email: letsencrypt.account@banditlair.com
traefik_domain: "traefik.{{banditlair_domain}}"
searx_domain: "searx.{{banditlair_domain}}"
anderia_domain: "anderia.{{banditlair_domain}}"
rook_domain: "rook.{{banditlair_domain}}"

View file

@ -15,7 +15,14 @@
tags: searx
- import_tasks: anderia-wiki.yml
tags:
- include_tasks:
file: wiki.yml
apply:
tags:
- wiki
vars:
wiki_instance: "{{ item }}"
loop:
- anderia
- wiki
- arkadia
tags: wiki

View file

@ -14,12 +14,10 @@
# Workaround until https://github.com/ansible/ansible/pull/59160 is released
- name: Remove last line of the manifest file
lineinfile:
path: /tmp/rook-common.yml
state: absent
regexp: '^---$'
command: sed -i '$ d' /tmp/rook-common.yml
delegate_to: localhost
changed_when: false
warn: false
- name: Apply Rook manifests
k8s:

View file

@ -1,4 +1,4 @@
- name: Anderia wiki deployment
- name: "{{ wiki_instance }} wiki deployment"
k8s:
namespace: default
state: present
@ -6,20 +6,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: anderia-wiki
name: "{{ wiki_instance }}-wiki"
spec:
replicas: 2
selector:
matchLabels:
app: anderia-wiki
app: "{{ wiki_instance }}-wiki"
template:
metadata:
labels:
app: anderia-wiki
app: "{{ wiki_instance }}-wiki"
spec:
containers:
- name: anderia-wiki
image: bitnami/dokuwiki
- name: "{{ wiki_instance }}-wiki"
image: bitnami/dokuwiki:0.20180422.201901061035
imagePullPolicy: IfNotPresent
ports:
- containerPort: 80
@ -32,18 +32,19 @@
path: /
port: 80
volumeMounts:
- mountPath: "/bitnami"
name: anderia-wiki-data
- mountPath: /bitnami
name: "{{ wiki_instance }}-wiki-data"
volumes:
- name: anderia-wiki-data
- name: "{{ wiki_instance }}-wiki-data"
flexVolume:
driver: ceph.rook.io/rook
fsType: ceph
options:
fsName: ceph-fs # name of the filesystem specified in the filesystem CRD.
clusterNamespace: rook-ceph # namespace where the Rook cluster is deployed
path: /wiki/{{ wiki_instance }}
- name: Anderia wiki service
- name: "{{ wiki_instance }} wiki service"
k8s:
namespace: default
state: present
@ -51,16 +52,16 @@
apiVersion: v1
kind: Service
metadata:
name: anderia-wiki
name: "{{ wiki_instance }}-wiki"
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 80
selector:
app: anderia-wiki
app: "{{ wiki_instance }}-wiki"
- name: Anderia wiki ingress
- name: "{{ wiki_instance }} wiki ingress"
k8s:
namespace: default
state: present
@ -68,7 +69,7 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: anderia
name: "{{ wiki_instance }}"
annotations:
kubernetes.io/ingress.class: nginx
certmanager.k8s.io/cluster-issuer: "{{cert_manager_issuer}}"
@ -76,14 +77,14 @@
# ingress.kubernetes.io/ssl-temporary-redirect: "false"
spec:
rules:
- host: "{{ anderia_domain }}"
- host: "{{ wiki_instance }}.{{banditlair_domain}}"
http:
paths:
- path: /
backend:
serviceName: anderia-wiki
serviceName: "{{ wiki_instance }}-wiki"
servicePort: 80
tls:
- hosts:
- "{{ anderia_domain }}"
secretName: anderia-cert
- "{{ wiki_instance }}.{{banditlair_domain}}"
secretName: "{{ wiki_instance }}-cert"