mirror of
https://git.ecdf.ed.ac.uk/win_automation/windows-ansible.git
synced 2026-10-26 09:47:21 +00:00
59 lines
1.7 KiB
YAML
59 lines
1.7 KiB
YAML
---
|
|
- name: Install scoop
|
|
tags: install_scoop
|
|
block:
|
|
- 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: Ensure parent directory exists
|
|
ansible.windows.win_file:
|
|
path: "C:\\resticprofile"
|
|
state: directory
|
|
tags: copy_restickey
|
|
|
|
- name: Copy restic key
|
|
ansible.windows.win_copy:
|
|
content: "{{ restic_password }}"
|
|
dest: "C:\\resticprofile\\restic.key"
|
|
force: false
|
|
tags: copy_restickey
|
|
|
|
- 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
|
|
- never
|
|
when: inventory_hostname in groups['meta-name_fs01']
|