3
0
forked from jakub/ansible
This commit is contained in:
fencl
2025-10-05 16:35:35 +02:00
parent fd7ec9a3e7
commit 65642d8114
2 changed files with 180 additions and 8 deletions

View File

@@ -43,12 +43,11 @@
state: present
update_cache: yes
- name: Run Collabora update commands on VM (via SSH)
- name: Run Collabora update commands on VM (via SSH) # use SSHPASS env, hide item value
ansible.builtin.command:
argv:
- sshpass
- -p
- "{{ vm_pass }}"
- -e # read password from SSHPASS environment
- ssh
- -o
- StrictHostKeyChecking=no
@@ -58,10 +57,14 @@
- bash
- -lc
- "{{ ('sudo ' if use_sudo else '') + item }}"
environment:
SSHPASS: "{{ vm_pass }}" # supply password via environment
loop: "{{ collabora_commands }}"
loop_control:
label: "cmd-{{ loop.index }}" # prevents dumping full item in (item=...) log line
register: collab_cmds
changed_when: false
no_log: "{{ DEBUG == 0 }}"
no_log: "{{ DEBUG == 0 }}" # hide outputs and env when not debugging
- name: Show outputs for each Collabora command
ansible.builtin.debug:
@@ -75,12 +78,14 @@
loop: "{{ collab_cmds.results }}"
when: DEBUG == 1
- name: Fail play if any Collabora command failed
- name: Fail play if any Collabora command failed # also hide item label
ansible.builtin.assert:
that: "item.rc == 0"
fail_msg: "Collabora update failed on VM: {{ item.item }} (rc={{ item.rc }})"
success_msg: "All Collabora update commands succeeded."
loop: "{{ collab_cmds.results }}"
loop_control:
label: "cmd-{{ loop.index }}"
# -------------------------
# Readiness checks (controller first, then VM fallback)
@@ -102,12 +107,11 @@
failed_when: false
changed_when: false
- name: Collabora | VM-side fetch (pure JSON via Python)
- name: Collabora | VM-side fetch (pure JSON via Python) # use SSHPASS env here too
ansible.builtin.command:
argv:
- sshpass
- -p
- "{{ vm_pass }}"
- -e
- ssh
- -o
- StrictHostKeyChecking=no
@@ -125,11 +129,14 @@
except Exception:
pass
PY
environment:
SSHPASS: "{{ vm_pass }}"
register: caps_vm
changed_when: false
failed_when: false
when: caps_controller.status | default(0) != 200 or caps_controller.json is not defined
no_log: "{{ DEBUG == 0 }}"
- name: Collabora | Choose JSON (controller wins, else VM)
ansible.builtin.set_fact:
collab_caps_json: >-