Fixed scheduled task creation

This commit is contained in:
abrown38 committed 2024-08-23 14:29:20 +01:00
1 parent 7b6450a1c2
commit bf4e24c40d
1 file changed
+15 -6
@@ -15,19 +15,27 @@
- 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: password
logon_type: s4u
path: "{{ scheduled_task_path }}"
actions:
- path: "{{ powershell_path }}"
arguments: "{{ script_folder }}\\{{ export_script }}"
arguments: "-NonInteractive -File {{ script_folder }}\\{{ export_script }}"
triggers:
- type: registration
- type: daily
start_boundary: "{{ task_start_time.stdout }}"
repetition:
interval: PT5M
@@ -37,13 +45,14 @@
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
logon_type: s4u
path: "{{ scheduled_task_path }}"
actions:
- path: "{{ powershell_path }}"
arguments: "{{ script_folder }}\\{{ import_script }}"
arguments: "-NonInteractive -File {{ script_folder }}\\{{ import_script }}"
triggers:
- type: registration
- type: daily
start_boundary: "{{ task_start_time.stdout }}"
repetition:
interval: PT5M
when: inventory_hostname in groups['meta-name_fs01']