dokuwiki: add ability to checkout custom theme repo #21

Closed
dario wants to merge 6 commits from eh22-wiki-design into main
3 changed files with 25 additions and 1 deletions
roles/dokuwiki

View file

@ -22,6 +22,12 @@ None.
- `dokuwiki__php_version`: Your PHP version, default `7.4` for Debian 11 and `8.2` for Debian 12
- `dokuwiki__php_user`: User of your php-fpm process, default `www-data`
- `dokuwiki__nginx_user`: User of your nginx process, default `nginx`
- `dokuwiki__custom_theme_git_url`: Clone URL of custom theme (HTTPS only)
- `dokuwiki__custom_theme_version`: Version (git branch, tag, ...) to checkout, default main
- `dokuwiki__custom_theme_name`: Name of the directory into which the custom theme is cloned
Warning: if a directory of the same name as `dokuwiki__custom_theme_name` already exists in the same directory, the task will fail.
This needs to be manually deleted first before the first run with the the custom theme enabled.
## nginx Configuration

View file

@ -3,3 +3,6 @@ dokuwiki__installpath: "/var/www/dokuwiki"
dokuwiki__php_version: "{{ dokuwiki__php_versions[ansible_distribution + '-' + ansible_distribution_major_version] }}"
dokuwiki__php_user: "www-data"
dokuwiki__nginx_user: "nginx"
dokuwiki__custom_theme_git_url: ""
dokuwiki__custom_theme_version: "main"
dokuwiki__custom_theme_name: ""

View file

@ -1,4 +1,4 @@
- name: Install php-fpm
- name: Install dependencies
become: true
ansible.builtin.apt:
name:
@ -9,6 +9,7 @@
- php-intl
- php-gd
- php-sqlite3
- git
diff: false
- name: Ensure `php-fpm` is enabled
@ -42,3 +43,17 @@
owner: root
group: root
mode: "0644"
- name: checkout custom theme git repo
become: true
june marked this conversation as resolved
Review

ansible-lint is failing as this module-use isn't idempotent. Let's introduce the following option and attribute for the module, to make it theoretically possible to be idempotent:

dokuwiki__custom_theme_version: "main"

And then set for ansible.builtin.git:

    version: "{{ dokuwiki__custom_theme_version }}"

Documentation for dokuwiki__custom_theme_version would be: version (git branch, tag, ...) to checkout, default main

`ansible-lint` is failing as this module-use isn't idempotent. Let's introduce the following option and attribute for the module, to make it theoretically possible to be idempotent: ```yaml dokuwiki__custom_theme_version: "main" ``` And then set for `ansible.builtin.git`: ```yaml version: "{{ dokuwiki__custom_theme_version }}" ``` Documentation for `dokuwiki__custom_theme_version` would be: version (git branch, tag, ...) to checkout, default `main`
ansible.builtin.git:
repo: "{{ dokuwiki__custom_theme_git_url }}"
dest: "{{ dokuwiki__installpath }}/lib/tpl/{{ dokuwiki__custom_theme_name }}"
version: "{{ dokuwiki__custom_theme_version }}"
force: true
depth: 1
single_branch: true
track_submodules: true
june marked this conversation as resolved
Review

Let's not do that, but encourage just using https://-clone URLs instead?

Let's not do that, but encourage just using `https://`-clone URLs instead?
Review

yeah the hostkey stuff makes sense.
but single branch makes sense as a shallow copy of the repo is sufficient to apply the theme, and if a theme uses submodules, these need to be pulled in as well

yeah the hostkey stuff makes sense. but single branch makes sense as a shallow copy of the repo is sufficient to apply the theme, and if a theme uses submodules, these need to be pulled in as well
Review

Oh yeah ofc, I'm just talking about:

    accept_hostkey: true
    accept_newhostkey: true

Forgejo doesn't allow highlighting specific ranges, so it just picked four lines it seems. :/

Oh yeah ofc, I'm just talking about: ``` accept_hostkey: true accept_newhostkey: true ``` Forgejo doesn't allow highlighting specific ranges, so it just picked four lines it seems. :/
when:
- dokuwiki__custom_theme_git_url != ""
- dokuwiki__custom_theme_name != ""