Обновить playbooks/install_software_win.yml
This commit is contained in:
1 parent
e2c6acaef8
commit
7d60f3bc2f
1 file changed
+23
-6
@@ -73,15 +73,32 @@
|
||||
msg: "Не удалось скопировать {{ installer_file }}: {{ copy_result.result.error | default('неизвестная ошибка') }}"
|
||||
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
|
||||
block:
|
||||
- name: Install {{ installer_file }}
|
||||
ansible.windows.win_package:
|
||||
path: "{{ local_file }}"
|
||||
state: present
|
||||
arguments: "{{ installer_args }}"
|
||||
product_id: "{{ product_id | default(omit) }}"
|
||||
creates_path: "{{ creates_path | default(omit) }}"
|
||||
ansible.windows.win_command: '"{{ local_file }}" /S /D=C:\Program Files\FreeCAD 1.1'
|
||||
args:
|
||||
creates: 'C:\Program Files\FreeCAD 1.1\bin\FreeCAD.exe'
|
||||
register: inst
|
||||
failed_when: inst.rc not in [0, 3010]
|
||||
always:
|
||||
- name: Remove local installer copy
|
||||
ansible.windows.win_file:
|
||||
|
||||
Reference in new issue
Block a user