2024-06-12 11:09:34 -04:00
|
|
|
# "ClassroomColor": "Dell C2660dn Color Laser PS",
|
|
|
|
{% set printers = {
|
|
|
|
"ClassroomColor_HP": "HP LJ300-400 color M351-M451 PCL6 Class Driver",
|
|
|
|
"Classroom_MFP": "Brother MFC-9970CDW Printer"
|
|
|
|
}
|
|
|
|
%}
|
|
|
|
|
|
|
|
|
|
|
|
# install all printer driver inf files
|
|
|
|
"PNPUtil.exe /add-driver \\\\ucs\\software\\drivers\\printers\\*.inf /subdirs /install":
|
2022-10-05 14:30:38 -04:00
|
|
|
cmd.run:
|
|
|
|
- shell: powershell
|
2024-06-12 11:09:34 -04:00
|
|
|
# TODO: ideally would actually check for success better
|
|
|
|
- success_retcodes: [1]
|
2022-10-05 14:30:38 -04:00
|
|
|
|
2024-06-12 11:09:34 -04:00
|
|
|
{% for printer, driver in printers.items() %}
|
2022-10-05 14:30:38 -04:00
|
|
|
# add the driver as a printer driver
|
2024-06-12 11:09:34 -04:00
|
|
|
"Add-PrinterDriver -Name '{{ driver }}'":
|
2022-10-05 14:30:38 -04:00
|
|
|
cmd.run:
|
|
|
|
- shell: powershell
|
2024-06-12 11:09:34 -04:00
|
|
|
- unless: Get-PrinterDriver -Name '{{ driver }}'
|
2022-10-05 14:30:38 -04:00
|
|
|
|
|
|
|
# add the printer
|
2024-06-12 11:09:34 -04:00
|
|
|
"Add-Printer -Name '{{ printer | replace('_', ' ')}}' -PortName 'http://ucs.sawtooth.claremontmakerspace.org:631/printers/{{ printer }}' -DriverName '{{ driver }}'":
|
|
|
|
cmd.run:
|
|
|
|
- shell: powershell
|
|
|
|
- unless: Get-Printer -Name '{{ printer | replace('_', ' ') }}'
|
|
|
|
{% endfor %}
|
2022-10-05 14:30:38 -04:00
|
|
|
cmd.run:
|
|
|
|
- shell: powershell
|
|
|
|
- unless: Get-Printer -Name ClassroomColor
|