22 lines
682 B
YAML
22 lines
682 B
YAML
---
|
|
- name: Send notification message via Slack
|
|
delegate_to: localhost
|
|
community.general.slack:
|
|
token: "{{ slack_token }}"
|
|
msg: Running Clean-up on {{ inventory_hostname }}
|
|
|
|
- name: Running Clean-up Scripts
|
|
ansible.windows.win_powershell:
|
|
script: |-
|
|
#Script to Clean-up
|
|
|
|
#Creating Directory
|
|
New-Item -Path 'D:\software\Archive' -ItemType Directory
|
|
|
|
$Users = 'ThalesAdmin','Installserveruser'
|
|
|
|
#Moving files to path (ThalesAdmin,Installserveruser)
|
|
foreach ($user in $Users) {
|
|
Get-ChildItem -Exclude *.lnk -Path "C:\Users\$user\Desktop\" -Recurse | Move-Item -Verbose -Force -Destination "D:\software\Archive"
|
|
}
|