Files
semaphore/playbooks/install_software_win.yml
T
Claude Sonnet 5 8ff6d59ba6 Restore from Gitea ZIP snapshot (12.08.2026) after full instance reinstall
Git history was lost when the previous Gitea instance was wiped and
reinstalled due to an unresolved corruption bug — this commit is the
last known-good file content, exported before the reinstall. Prior
commit history is not recoverable through this path.
2026-08-12 19:24:02 +00:00

60 lines
2.1 KiB
YAML

---
- name: Install Software from SMB
hosts: windows
gather_facts: no
# Не забываем про коллекции, если они нужны
collections:
- community.windows
- ansible.windows
vars:
drive_letter: "Z"
# smb_user, smb_pass, smb_path приходят из Semaphore Environment
tasks:
# 1. СНАЧАЛА УДАЛЯЕМ ДИСК (Принудительная зачистка)
# Это гарантирует, что старые зависшие сессии не помешают
- name: Force unmount Z drive
community.windows.win_mapped_drive:
letter: "{{ drive_letter }}"
state: absent
ignore_errors: yes # Не падать, если диска и так нет
# 2. ТЕПЕРЬ МОНТИРУЕМ НАЧИСТО
- name: Mount Network Drive
community.windows.win_mapped_drive:
letter: "{{ drive_letter }}"
path: "{{ smb_path }}"
username: "{{ smb_user }}"
password: "{{ smb_pass }}"
state: present
# 3. Проверяем файлы (для отладки)
- name: Check file existence
win_stat:
path: "{{ drive_letter }}:\\Stirling-PDF.msi"
register: file_info
# 4. Установка
#- name: Install Stirling-PDF (MSI)
# ansible.windows.win_package:
# path: "{{ drive_letter }}:\\Stirling-PDF.msi"
# state: present
# arguments: /quiet /norestart
# when: file_info.stat.exists
# Пример 2: Установка EXE (mango)
- name: Install mango (EXE)
ansible.windows.win_package:
path: "{{ drive_letter }}:\\mango.exe"
state: present
# Для EXE ключи тихой установки зависят от установщика (/S, /VERYSILENT и т.д.)
arguments: /--silent
product_id: mango # Помогает Ansible понять, установлен ли софт
# 5. Уборка
- name: Unmount Network Drive
community.windows.win_mapped_drive:
letter: "{{ drive_letter }}"
state: absent