Обновить playbooks/install_software_win.yml

This commit is contained in:
ogrechko committed 2026-10-02 12:31:58 +03:00
1 parent e2c6acaef8
commit 7d60f3bc2f
1 file changed
+23 -6
+23 -6
View File
@@ -73,15 +73,32 @@
msg: "Не удалось скопировать {{ installer_file }}: {{ copy_result.result.error | default('неизвестная ошибка') }}" msg: "Не удалось скопировать {{ installer_file }}: {{ copy_result.result.error | default('неизвестная ошибка') }}"
when: not (copy_result.result.copied | default(false)) when: not (copy_result.result.copied | default(false))
- name: Install and clean up
block:
- name: Check running FreeCAD
ansible.windows.win_shell: |
Get-Process FreeCAD -IncludeUserName -ErrorAction SilentlyContinue |
ForEach-Object { "$($_.UserName) (session $($_.SessionId))" }
register: running
changed_when: false
- name: Fail if FreeCAD is running
ansible.builtin.fail:
msg: "FreeCAD запущен у: {{ running.stdout_lines | join(', ') }}. Закройте его или включите force_close."
when: running.stdout_lines | length > 0 and not (force_close | default(false) | bool)
- name: Force close FreeCAD
ansible.windows.win_shell: Stop-Process -Name FreeCAD -Force
when: running.stdout_lines | length > 0 and (force_close | default(false) | bool)
- name: Install and clean up - name: Install and clean up
block: block:
- name: Install {{ installer_file }} - name: Install {{ installer_file }}
ansible.windows.win_package: ansible.windows.win_command: '"{{ local_file }}" /S /D=C:\Program Files\FreeCAD 1.1'
path: "{{ local_file }}" args:
state: present creates: 'C:\Program Files\FreeCAD 1.1\bin\FreeCAD.exe'
arguments: "{{ installer_args }}" register: inst
product_id: "{{ product_id | default(omit) }}" failed_when: inst.rc not in [0, 3010]
creates_path: "{{ creates_path | default(omit) }}"
always: always:
- name: Remove local installer copy - name: Remove local installer copy
ansible.windows.win_file: ansible.windows.win_file: