From 23de7d42891deed7653622bcaa0f66e43c17a536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=9A=D0=BE?= =?UTF-8?q?=D0=B7=D0=BB=D1=8E=D0=BA?= Date: Sun, 29 Jan 2023 01:32:05 +0300 Subject: [PATCH] gitea: idempotency The role was not idempotent because multiple tasks changed Gitea configuration sequentially, despite each task being idempotent. Revert to the single configuration template. --- .../files/custom/templates/custom/header.tmpl | 3 ++- roles/gitea/tasks/jupyter.yml | 27 ------------------- roles/gitea/tasks/pptx.yml | 13 --------- roles/gitea/templates/gitea.ini | 13 +++++++++ 4 files changed, 15 insertions(+), 41 deletions(-) diff --git a/roles/gitea/files/custom/templates/custom/header.tmpl b/roles/gitea/files/custom/templates/custom/header.tmpl index 8b71be4..739fa8c 100644 --- a/roles/gitea/files/custom/templates/custom/header.tmpl +++ b/roles/gitea/files/custom/templates/custom/header.tmpl @@ -1 +1,2 @@ - + + diff --git a/roles/gitea/tasks/jupyter.yml b/roles/gitea/tasks/jupyter.yml index f4daccd..247cf9a 100644 --- a/roles/gitea/tasks/jupyter.yml +++ b/roles/gitea/tasks/jupyter.yml @@ -9,30 +9,3 @@ src: 'convert-ipynb.sh' dest: '/usr/local/bin/convert-ipynb' mode: 0755 - -- name: ensure Jupyter assets on all pages - blockinfile: - path: '/var/lib/gitea/custom/templates/custom/header.tmpl' - block: | - - - marker: '' - notify: 'restart Gitea' - -- name: configure Gitea - blockinfile: - path: '/etc/gitea/app.ini' - block: | - [markup.jupyter] - ENABLED = true - FILE_EXTENSIONS = .ipynb - RENDER_COMMAND = /usr/local/bin/convert-ipynb - IS_INPUT_FILE = false - marker: '# {mark} ANSIBLE MANAGED BLOCK: Jupyter' - notify: 'restart Gitea' diff --git a/roles/gitea/tasks/pptx.yml b/roles/gitea/tasks/pptx.yml index a67e730..1c6fbe2 100644 --- a/roles/gitea/tasks/pptx.yml +++ b/roles/gitea/tasks/pptx.yml @@ -31,16 +31,3 @@ src: 'fontconfig.conf' dest: '/var/lib/git/.local/share/fonts/local.conf' notify: 'update font cache' - -- name: configure Gitea - blockinfile: - path: '/etc/gitea/app.ini' - block: | - [markup.pptx] - ENABLED = true - FILE_EXTENSIONS = .pptx - RENDER_COMMAND = /usr/local/bin/convert-pptx - IS_INPUT_FILE = true - RENDER_CONTENT_MODE = pdf - marker: '# {mark} ANSIBLE MANAGED BLOCK: PPTX' - notify: 'restart Gitea' diff --git a/roles/gitea/templates/gitea.ini b/roles/gitea/templates/gitea.ini index 7258d99..3c2aff1 100644 --- a/roles/gitea/templates/gitea.ini +++ b/roles/gitea/templates/gitea.ini @@ -46,3 +46,16 @@ NAMES = Русский,English [repository] ROOT = /var/lib/gitea/data/gitea-repositories + +[markup.pptx] +ENABLED = true +FILE_EXTENSIONS = .pptx +RENDER_COMMAND = /usr/local/bin/convert-pptx +IS_INPUT_FILE = true +RENDER_CONTENT_MODE = pdf + +[markup.jupyter] +ENABLED = true +FILE_EXTENSIONS = .ipynb +RENDER_COMMAND = /usr/local/bin/convert-ipynb +IS_INPUT_FILE = false