3
0
forked from jakub/ansible
This commit is contained in:
fencl
2025-10-05 15:45:37 +02:00
parent 928a131ac8
commit b834c2e4c4
3 changed files with 19 additions and 174 deletions

View File

@@ -14,6 +14,9 @@
vm_pass: "{{ lookup('env', 'VM_PASS') }}"
use_sudo: false
# --- Debug mode (controlled via Semaphore variable) ---
DEBUG: "{{ lookup('env', 'DEBUG') | default(0) | int }}"
# --- Collabora specifics ---
collabora_debug_caps: true
collabora_caps_url: "https://collabora.martinfencl.eu/hosting/capabilities"
@@ -57,6 +60,7 @@
loop: "{{ collabora_commands }}"
register: collab_cmds
changed_when: false
no_log: "{{ DEBUG == 0 }}" # 🔒 Hide sensitive info when DEBUG=0
- name: Show outputs for each Collabora command
ansible.builtin.debug:
@@ -68,6 +72,7 @@
STDERR:
{{ (item.stderr | default('')).strip() }}
loop: "{{ collab_cmds.results }}"
when: DEBUG == 1 # 🪵 Only show debug output if DEBUG=1
- name: Fail play if any Collabora command failed
ansible.builtin.assert:
@@ -123,6 +128,7 @@
changed_when: false
failed_when: false
when: caps_controller.status | default(0) != 200 or caps_controller.json is not defined
no_log: "{{ DEBUG == 0 }}" # 🔒 Hide command and output when not debugging
- name: Collabora | Choose JSON (controller wins, else VM)
ansible.builtin.set_fact:
@@ -145,15 +151,15 @@
({{ collab_caps_json.productName | default('?') }}),
convert-to.available={{ collab_caps_json['convert-to']['available'] | default('n/a') }},
serverId={{ collab_caps_json.serverId | default('n/a') }}
when: collab_caps_json is defined
when: collab_caps_json is defined and DEBUG == 1 # 🪵 Only print in debug mode
- name: Collabora | Capabilities unavailable (after retries)
ansible.builtin.debug:
msg: "Capabilities endpoint není dostupný ani po pokusech."
when: collab_caps_json is not defined
when: collab_caps_json is not defined and DEBUG == 1
# Optional full JSON (debug)
- name: Collabora | Full JSON (debug)
ansible.builtin.debug:
var: collab_caps_json
when: collabora_debug_caps and (collab_caps_json is defined)
when: collabora_debug_caps and (collab_caps_json is defined) and DEBUG == 1 # 🪵 Only when debugging