first commit
This commit is contained in:
48
roles/windows_printer-export/tasks/main.yml
Normal file
48
roles/windows_printer-export/tasks/main.yml
Normal file
@@ -0,0 +1,48 @@
|
||||
---
|
||||
# tasks file for windows_printer-export
|
||||
- name: Create directory structure
|
||||
ansible.windows.win_file:
|
||||
path: \\awe-mps-006.adagility.net\cor$\{{ansible_date_time.year + ansible_date_time.month + ansible_date_time.day}}\Infra\Configs\PRINTER\
|
||||
state: directory
|
||||
|
||||
- name: clean all services
|
||||
win_nssm:
|
||||
name: printer-export-{{item}}
|
||||
state: absent
|
||||
loop: "{{printers}}"
|
||||
|
||||
- name: create services for printer exports
|
||||
community.windows.win_nssm:
|
||||
name: printer-export-{{item}}
|
||||
application: "C:\\Windows\\System32\\spool\\tools\\PrintBrm.exe"
|
||||
app_parameters: _=-b; -s=\\{{item}}; -f=\\awe-mps-006.adagility.net\cor$\{{ansible_date_time.year + ansible_date_time.month + ansible_date_time.day}}\Infra\Configs\PRINTER\{{item}}.printerexport
|
||||
stdout_file: F:\{{item}}.txt
|
||||
stderr_file: F:\{{item}}-err.txt
|
||||
start_mode: manual
|
||||
state: started
|
||||
user: '{{username}}'
|
||||
password: '{{password}}'
|
||||
no_log: True
|
||||
loop: "{{printers}}"
|
||||
|
||||
|
||||
|
||||
|
||||
- name: Start all services
|
||||
ansible.windows.win_service:
|
||||
name: printer-export-{{item}}
|
||||
state: started
|
||||
loop: "{{printers}}"
|
||||
|
||||
|
||||
# - name: check if file exists
|
||||
# ansible.windows.win_file:
|
||||
# path: \\awe-mps-006.adagility.net\cor$\{{ansible_date_time.year + ansible_date_time.month + ansible_date_time.day}}\Infra\Configs\PRINTER\{{item}}.printerexport
|
||||
# loop: "{{printers}}"
|
||||
|
||||
|
||||
# printbrm.exe -b -s \\gns-don-01 -f "\\awe-mps-006.adagility.net\cor$\$(get-date -f yyyyMMdd)\Infra\Configs\PRINTER\gns-don-01.printerexport"
|
||||
|
||||
# C:\Windows\System32\spool\tools\PrintBrm.exe -b -s \\gns-don-01 -f "\\awe-mps-006.adagility.net\cor$\$(get-date -f yyyyMMdd)\Infra\Configs\PRINTER\gns-don-01.printerexport"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user