mirror of
https://git.ecdf.ed.ac.uk/win_automation/windows-ansible.git
synced 2026-10-26 21:07:21 +00:00
58 lines
2.0 KiB
YAML
58 lines
2.0 KiB
YAML
---
|
|
- name: Copy scripts to fileserver
|
|
tags: copy_scheduled_tasks
|
|
block:
|
|
- name: Copy transfer scripts to fileserver
|
|
win_copy:
|
|
src: "{{ item }}"
|
|
dest: "{{ script_folder }}"
|
|
force: true
|
|
loop:
|
|
- "{{ import_script }}"
|
|
- "{{ export_script }}"
|
|
when: inventory_hostname in groups['meta-name_fs01']
|
|
|
|
- name: Create Scheduled Tasks
|
|
tags: create_scheduled_tasks
|
|
block:
|
|
- name: Get date +5 minutes for task start time
|
|
vars:
|
|
ansible_connection: local
|
|
shell: /usr/bin/date --date="+5 minutes" "+%Y-%m-%dT%T"
|
|
delegate_to: localhost
|
|
register: task_start_time
|
|
|
|
- name: Create export scheduled task
|
|
community.windows.win_scheduled_task:
|
|
name: Export
|
|
description: Move files from Windows projects on S:\ to the folders on T:\ for Transfer
|
|
username: "{{ win_project }}\\{{ filetransfer_user }}"
|
|
password: "{{ transfer_user_password }}"
|
|
logon_type: s4u
|
|
path: "{{ scheduled_task_path }}"
|
|
actions:
|
|
- path: "{{ powershell_path }}"
|
|
arguments: "-NonInteractive -File {{ script_folder }}\\{{ export_script }}"
|
|
triggers:
|
|
- type: daily
|
|
start_boundary: "{{ task_start_time.stdout }}"
|
|
repetition:
|
|
interval: PT5M
|
|
|
|
- name: Create import scheduled task
|
|
win_scheduled_task:
|
|
name: Import
|
|
description: Move files from Windows projects on T:\ to the folders on S:\ for Transfer
|
|
username: "{{ win_project }}\\{{ filetransfer_user }}"
|
|
password: "{{ transfer_user_password }}"
|
|
logon_type: s4u
|
|
path: "{{ scheduled_task_path }}"
|
|
actions:
|
|
- path: "{{ powershell_path }}"
|
|
arguments: "-NonInteractive -File {{ script_folder }}\\{{ import_script }}"
|
|
triggers:
|
|
- type: daily
|
|
start_boundary: "{{ task_start_time.stdout }}"
|
|
repetition:
|
|
interval: PT5M
|
|
when: inventory_hostname in groups['meta-name_fs01'] |