Files
windows-ansible/ansible/roles/win_fileserver/tasks/backups.yml
T
2025-04-14 09:29:54 +01:00

48 lines
1.5 KiB
YAML

---
- name: Install scoop
tags: install_scoop
block:
#- name: download install script
# ansible.windows.win_powershell:
# script: |
# irm get.scoop.sh -outfile 'C:\eidf\install.ps1'
- name: Run install script
win_shell: |
powershell Invoke-RestMethod -Uri https://get.scoop.sh -outfile 'C:\eidf\install.ps1'
powershell -File "C:\eidf\install.ps1" -RunAsAdmin
register: scoop_install
rescue:
- name: Check if Scoop is already installed
debug:
msg: "Scoop is already installed, continuing..."
when: scoop_install.stdout is search("Scoop is already installed")
- name: Fail if other error occurred
fail:
msg: "Scoop installation failed with unexpected error."
when: scoop_install.stdout is not search("Scoop is already installed")
when: inventory_hostname in groups['meta-name_fs01']
- name: setup backups
tags: setup_backups
block:
- name: Install restic
win_shell: scoop install restic
tags: install_restic
- name: Install resticprofile
win_shell: scoop install resticprofile
tags: install_resticprofile
- name: Copy resticprofile
ansible.windows.win_template:
src: "profiles.yaml"
dest: "C:\\resticprofile"
force: true
tags: copy_resticprofile
- name: Schedule resticprofile
win_shell: resticprofile -n study_data schedule
tags: schedule_resticprofile
when: inventory_hostname in groups['meta-name_fs01']