diff options
Diffstat (limited to 'roles')
-rw-r--r-- | roles/apps/etherpad-lite/tasks/main.yml | 23 | ||||
-rw-r--r-- | roles/apps/etherpad-lite/templates/pod-spec-with-mariadb.yml.j2 | 49 | ||||
-rw-r--r-- | roles/apps/etherpad-lite/templates/pod-with-mariadb.yml.j2 | 54 |
3 files changed, 63 insertions, 63 deletions
diff --git a/roles/apps/etherpad-lite/tasks/main.yml b/roles/apps/etherpad-lite/tasks/main.yml index 0beeb1e1..416ab7ff 100644 --- a/roles/apps/etherpad-lite/tasks/main.yml +++ b/roles/apps/etherpad-lite/tasks/main.yml @@ -92,24 +92,29 @@ owner: "{{ etherpad_lite_app_uid }}" group: "{{ etherpad_lite_app_gid }}" - -- name: generate pod manifests +- name: install pod manifest loop: "{{ etherpad_lite_instances | dict2items }}" loop_control: label: "{{ item.key }}" - template: - src: "pod-with-{{ item.value.database.type }}.yml.j2" - dest: "/etc/kubernetes/manifests/etherpad-lite-{{ item.key }}.yml" - mode: 0600 - + vars: + kubernetes_standalone_pod: + name: "etherpad-lite-{{ item.key }}" + spec: "{{ lookup('template', 'pod-spec-with-{{ item.value.database.type }}.yml.j2') }}" + mode: 0600 + config_hash_items: + - path: "{{ etherpad_lite_base_path }}/{{ item.key }}/config/settings.json" + properties: + - checksum + include_role: + name: kubernetes/standalone/pod - name: configure nginx vhost loop: "{{ etherpad_lite_instances | dict2items }}" - include_role: - name: nginx/vhost vars: nginx_vhost: name: "etherpad-lite-{{ item.key }}" content: "{{ lookup('template', 'nginx-vhost.conf.j2') }}" acme: true hostnames: "{{ item.value.hostnames }}" + include_role: + name: nginx/vhost diff --git a/roles/apps/etherpad-lite/templates/pod-spec-with-mariadb.yml.j2 b/roles/apps/etherpad-lite/templates/pod-spec-with-mariadb.yml.j2 new file mode 100644 index 00000000..f608d6ab --- /dev/null +++ b/roles/apps/etherpad-lite/templates/pod-spec-with-mariadb.yml.j2 @@ -0,0 +1,49 @@ +securityContext: + allowPrivilegeEscalation: false +containers: +- name: etherpad-lite + image: spreadspace/etherpad-lite:{{ item.value.version }} + # securityContext: + # runAsUser: {{ etherpad_lite_app_uid }} + # runAsGroup: {{ etherpad_lite_app_gid }} + resources: + limits: + memory: "4Gi" + volumeMounts: + - name: config + mountPath: /opt/etherpad-lite/settings.json + subPath: settings.json + readOnly: true + ports: + - containerPort: 9001 + hostPort: {{ item.value.port }} + hostIP: 127.0.0.1 +- name: database + image: "mariadb:{{ item.value.database.version }}" + securityContext: + runAsUser: {{ etherpad_lite_db_uid }} + runAsGroup: {{ etherpad_lite_db_gid }} + resources: + limits: + memory: "4Gi" + env: + - name: MYSQL_RANDOM_ROOT_PASSWORD + value: "true" + - name: MYSQL_DATABASE + value: etherpad-lite + - name: MYSQL_USER + value: etherpad-lite + - name: MYSQL_PASSWORD + value: "{{ item.value.database.password }}" + volumeMounts: + - name: database + mountPath: /var/lib/mysql +volumes: +- name: config + hostPath: + path: "{{ etherpad_lite_base_path }}/{{ item.key }}/config/" + type: Directory +- name: database + hostPath: + path: "{{ etherpad_lite_base_path }}/{{ item.key }}/{{ item.value.database.type }}" + type: Directory diff --git a/roles/apps/etherpad-lite/templates/pod-with-mariadb.yml.j2 b/roles/apps/etherpad-lite/templates/pod-with-mariadb.yml.j2 deleted file mode 100644 index 9391290f..00000000 --- a/roles/apps/etherpad-lite/templates/pod-with-mariadb.yml.j2 +++ /dev/null @@ -1,54 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: "etherpad-lite-{{ item.key }}" -spec: - securityContext: - allowPrivilegeEscalation: false - containers: - - name: etherpad-lite - image: spreadspace/etherpad-lite:{{ item.value.version }} - # securityContext: - # runAsUser: {{ etherpad_lite_app_uid }} - # runAsGroup: {{ etherpad_lite_app_gid }} - resources: - limits: - memory: "4Gi" - volumeMounts: - - name: config - mountPath: /opt/etherpad-lite/settings.json - subPath: settings.json - readOnly: true - ports: - - containerPort: 9001 - hostPort: {{ item.value.port }} - hostIP: 127.0.0.1 - - name: database - image: "mariadb:{{ item.value.database.version }}" - securityContext: - runAsUser: {{ etherpad_lite_db_uid }} - runAsGroup: {{ etherpad_lite_db_gid }} - resources: - limits: - memory: "4Gi" - env: - - name: MYSQL_RANDOM_ROOT_PASSWORD - value: "true" - - name: MYSQL_DATABASE - value: etherpad-lite - - name: MYSQL_USER - value: etherpad-lite - - name: MYSQL_PASSWORD - value: "{{ item.value.database.password }}" - volumeMounts: - - name: database - mountPath: /var/lib/mysql - volumes: - - name: config - hostPath: - path: "{{ etherpad_lite_base_path }}/{{ item.key }}/config/" - type: Directory - - name: database - hostPath: - path: "{{ etherpad_lite_base_path }}/{{ item.key }}/{{ item.value.database.type }}" - type: Directory |