Files
windows-ansible/ansible/roles/win_fileserver/tasks/scheduled_tasks.yml
T

49 lines
1.6 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: 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: password
path: "{{ scheduled_task_path }}"
actions:
- path: "{{ powershell_path }}"
arguments: "{{ script_folder }}\\{{ export_script }}"
triggers:
- type: registration
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: password
path: "{{ scheduled_task_path }}"
actions:
- path: "{{ powershell_path }}"
arguments: "{{ script_folder }}\\{{ import_script }}"
triggers:
- type: registration
repetition:
interval: PT5M
when: inventory_hostname in groups['meta-name_fs01']