Refactor other modules tasks

This commit is contained in:
Tobias Reisinger 2026-11-13 16:15:34 +01:00
commit 1e684d3631
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
5 changed files with 34 additions and 7 deletions

View file

@ -12,8 +12,7 @@ phpvms_app_key: "{{ undef() }}"
phpvms_domain: "kondor-virtual.de" phpvms_domain: "kondor-virtual.de"
phpvms_assets_url: "{{ undef() }}" phpvms_assets_url: "{{ undef() }}"
phpvms_other_modules_json: "[]" phpvms_other_modules: "{{ undef() }}"
phpvms_other_modules: "{{ phpvms_other_modules_json | from_json }}"
phpvms_acars_module_src: "{{ undef() }}" phpvms_acars_module_src: "{{ undef() }}"
phpvms_sptheme_src: "{{ undef() }}" phpvms_sptheme_src: "{{ undef() }}"

View file

@ -55,17 +55,33 @@
notify: Restart service {{ service_name }} notify: Restart service {{ service_name }}
when: service_name == role_name # Only use on the "main" instance when: service_name == role_name # Only use on the "main" instance
# You must provide this files yourself. - name: Get other modules from nextcloud share
ansible.builtin.uri:
url: "{{ phpvms_other_modules }}"
method: PROPFIND
return_content: true
status_code: [200, 207]
register: phpvms_other_modules_response
- name: Transform response into list
ansible.builtin.set_fact:
phpvms_other_modules_host: "{{ phpvms_other_modules | urlsplit('hostname') }}"
phpvms_other_modules_list: "{{ phpvms_other_modules_xml['d:multistatus']['d:response'] | map(attribute='d:href') }}"
delegate_to: localhost
vars:
phpvms_other_modules_xml: "{{ phpvms_other_modules_response.content | ansible.utils.from_xml }}"
- name: Load other modules - name: Load other modules
ansible.builtin.unarchive: ansible.builtin.unarchive:
src: "{{ item }}" src: "https://{{ phpvms_other_modules_host }}{{ item }}"
dest: "{{ (service_path, 'modules') | path_join }}" dest: "{{ (service_path, 'modules') | path_join }}"
owner: "{{ phpvms_uid }}" owner: "{{ phpvms_uid }}"
group: "{{ phpvms_gid }}" group: "{{ phpvms_gid }}"
remote_src: "{{ item.startswith('https://') }}" remote_src: true
become: true become: true
notify: Restart service {{ service_name }} notify: Restart service {{ service_name }}
loop: "{{ phpvms_other_modules | default([]) }}" loop: "{{ phpvms_other_modules_list }}"
when: "item.endswith('.zip')"
- name: Load DisposableBasic - name: Load DisposableBasic
ansible.builtin.unarchive: ansible.builtin.unarchive:

View file

@ -66,6 +66,6 @@ semaphoreui_compose:
USER root USER root
RUN apk add --no-cache python3 py3-pip RUN apk add --no-cache python3 py3-pip
RUN pip install infisicalsdk RUN pip install infisicalsdk xmltodict
USER semaphore USER semaphore

View file

@ -11,4 +11,5 @@ dependencies = [
"infisicalsdk", "infisicalsdk",
"jinja2", "jinja2",
"python-hcl2", "python-hcl2",
"xmltodict",
] ]

11
uv.lock generated
View file

@ -496,6 +496,7 @@ dependencies = [
{ name = "infisicalsdk" }, { name = "infisicalsdk" },
{ name = "jinja2" }, { name = "jinja2" },
{ name = "python-hcl2" }, { name = "python-hcl2" },
{ name = "xmltodict" },
] ]
[package.metadata] [package.metadata]
@ -506,6 +507,7 @@ requires-dist = [
{ name = "infisicalsdk" }, { name = "infisicalsdk" },
{ name = "jinja2" }, { name = "jinja2" },
{ name = "python-hcl2" }, { name = "python-hcl2" },
{ name = "xmltodict" },
] ]
[[package]] [[package]]
@ -900,6 +902,15 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/8a/24/8a5bbb3e73962b5bc901966f926b4fe25cbc9d1170ad9b4d9938441dbdc3/wcmatch-12.0.1-py3-none-any.whl", hash = "sha256:0e11b0bf1700bc8222ad5e7dc79fb326d9e0304458c7e2c25419ab6d26d07d8e", size = 51084, upload-time = "2026-11-07T21:45:35.661Z" }, { url = "https://files.pythonhosted.org/packages/8a/24/8a5bbb3e73962b5bc901966f926b4fe25cbc9d1170ad9b4d9938441dbdc3/wcmatch-12.0.1-py3-none-any.whl", hash = "sha256:0e11b0bf1700bc8222ad5e7dc79fb326d9e0304458c7e2c25419ab6d26d07d8e", size = 51084, upload-time = "2026-11-07T21:45:35.661Z" },
] ]
[[package]]
name = "xmltodict"
version = "1.0.4"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/19/70/80f3b7c10d2630aa66414bf23d210386700aa390547278c789afa994fd7e/xmltodict-1.0.4.tar.gz", hash = "sha256:6d94c9f834dd9e44514162799d344d815a3a4faec913717a9ecbfa5be1bb8e61", size = 26124, upload-time = "2026-02-22T02:21:22.074Z" }
wheels = [
{ url = "https://files.pythonhosted.org/packages/38/34/98a2f52245f4d47be93b580dae5f9861ef58977d73a79eb47c58f1ad1f3a/xmltodict-1.0.4-py3-none-any.whl", hash = "sha256:a4a00d300b0e1c59fc2bfccb53d7b2e88c32f200df138a0dd2229f842497026a", size = 13580, upload-time = "2026-02-22T02:21:21.039Z" },
]
[[package]] [[package]]
name = "yamllint" name = "yamllint"
version = "1.38.0" version = "1.38.0"