summaryrefslogtreecommitdiff
path: root/roles
diff options
context:
space:
mode:
Diffstat (limited to 'roles')
-rw-r--r--roles/apps/collabora/code/tasks/main.yml23
-rw-r--r--roles/apps/collabora/code/templates/pod-spec.yml.j225
-rw-r--r--roles/apps/collabora/code/templates/pod.yml.j230
-rw-r--r--roles/kubernetes/standalone/pod/tasks/main.yml9
4 files changed, 46 insertions, 41 deletions
diff --git a/roles/apps/collabora/code/tasks/main.yml b/roles/apps/collabora/code/tasks/main.yml
index 57bdfa34..6b41bf5a 100644
--- a/roles/apps/collabora/code/tasks/main.yml
+++ b/roles/apps/collabora/code/tasks/main.yml
@@ -21,19 +21,26 @@
when: "'custom_image' in item.value"
include_tasks: custom-image.yml
-- name: generate pod manifests
+- name: install pod manifest
loop: "{{ collabora_code_instances | dict2items }}"
loop_control:
label: "{{ item.key }}"
- template:
- src: "pod.yml.j2"
- dest: "/etc/kubernetes/manifests/collabora-code-{{ item.key }}.yml"
- mode: 0600
+ vars:
+ kubernetes_standalone_pod:
+ name: "collabora-code-{{ item.key }}"
+ spec: "{{ lookup('template', 'pod-spec.yml.j2') }}"
+ mode: 0600
+ config_hash_items:
+ - path: "{{ collabora_code_base_path }}/{{ item.key }}/config/loolwsd.xml"
+ properties:
+ - checksum
+ include_role:
+ name: kubernetes/standalone/pod
- name: configure nginx vhost
loop: "{{ collabora_code_instances | dict2items }}"
- include_role:
- name: nginx/vhost
+ loop_control:
+ label: "{{ item.key }}"
vars:
nginx_vhost:
name: "collabora-code-{{ item.key }}"
@@ -41,3 +48,5 @@
acme: true
hostnames:
- "{{ item.value.hostname }}"
+ include_role:
+ name: nginx/vhost
diff --git a/roles/apps/collabora/code/templates/pod-spec.yml.j2 b/roles/apps/collabora/code/templates/pod-spec.yml.j2
new file mode 100644
index 00000000..04d2d25a
--- /dev/null
+++ b/roles/apps/collabora/code/templates/pod-spec.yml.j2
@@ -0,0 +1,25 @@
+containers:
+- name: collabora-code
+ image: "collabora/code{% if 'custom_image' in item.value %}/{{ item.key }}{% endif %}:{{ item.value.version }}"
+ resources:
+ limits:
+ memory: "4Gi"
+ env:
+ - name: "DONT_GEN_SSL_CERT"
+ value: "1"
+ - name: "extra_params"
+ value: "--o:ssl.enable=false --o:ssl.termination=true"
+ volumeMounts:
+ - name: config
+ mountPath: /etc/loolwsd/loolwsd.xml
+ subPath: loolwsd.xml
+ readOnly: true
+ ports:
+ - containerPort: 9980
+ hostPort: {{ item.value.port }}
+ hostIP: 127.0.0.1
+volumes:
+- name: config
+ hostPath:
+ path: "{{ collabora_code_base_path }}/{{ item.key }}/config/"
+ type: Directory
diff --git a/roles/apps/collabora/code/templates/pod.yml.j2 b/roles/apps/collabora/code/templates/pod.yml.j2
deleted file mode 100644
index 53fb4c0d..00000000
--- a/roles/apps/collabora/code/templates/pod.yml.j2
+++ /dev/null
@@ -1,30 +0,0 @@
-apiVersion: v1
-kind: Pod
-metadata:
- name: "collabora-code-{{ item.key }}"
-spec:
- containers:
- - name: collabora-code
- image: "collabora/code{% if 'custom_image' in item.value %}/{{ item.key }}{% endif %}:{{ item.value.version }}"
- resources:
- limits:
- memory: "4Gi"
- env:
- - name: "DONT_GEN_SSL_CERT"
- value: "1"
- - name: "extra_params"
- value: "--o:ssl.enable=false --o:ssl.termination=true"
- volumeMounts:
- - name: config
- mountPath: /etc/loolwsd/loolwsd.xml
- subPath: loolwsd.xml
- readOnly: true
- ports:
- - containerPort: 9980
- hostPort: {{ item.value.port }}
- hostIP: 127.0.0.1
- volumes:
- - name: config
- hostPath:
- path: "{{ collabora_code_base_path }}/{{ item.key }}/config/"
- type: Directory
diff --git a/roles/kubernetes/standalone/pod/tasks/main.yml b/roles/kubernetes/standalone/pod/tasks/main.yml
index 73048a81..7f87cf3f 100644
--- a/roles/kubernetes/standalone/pod/tasks/main.yml
+++ b/roles/kubernetes/standalone/pod/tasks/main.yml
@@ -10,9 +10,10 @@
- name: gather stats for config-hash items
loop: "{{ kubernetes_standalone_pod.config_hash_items }}"
loop_control:
- label: "{{ item.path }} ({{ item.properties | sort | join(', ') }})"
+ loop_var: config_hash_item
+ label: "{{ config_hash_item.path }} ({{ config_hash_item.properties | sort | join(', ') }})"
stat:
- path: "{{ item.path }}"
+ path: "{{ config_hash_item.path }}"
get_checksum: yes
checksum_algorithm: sha256
register: config_hash_items_stat
@@ -25,8 +26,8 @@
copy:
content: |
{% for result in config_hash_items_stat.results %}
- {{ result.item.path }}:
- {% for property in (result.item.properties | sort) %}
+ {{ result.config_hash_item.path }}:
+ {% for property in (result.config_hash_item.properties | sort) %}
{{ property }}: {{ result.stat[property] }}
{% endfor %}
{% endfor %}