HP41.cups
Ansible Role: CUPS
Overview
This role installs CUPS (Common Unix Printing System), sets up the necessary drivers (PPDs), and configures printers and classes in CUPS.
What It Does
- Installs
cups
andcups-pdf
. - Users listed in
cups_lpadmin_users
will be added to thelpadmin
group, giving them administrative access to CUPS. - Installs
cups-lpd
based on specific variables:- Creates a user for the cups-lpd process.
- Installs
xinetd
to manage cups-lpd as a service using a template file.
- Configures CUPS:
- If provided, it will build and copy configuration templates for cupsd.conf, cups-browsed.conf, and snmp.conf.
- If SSL certificates are provided, it will copy them to the correct location.
Installing PPDs
- Creates the folder
/opt/share/ppd
for PPD files. - Adds the OpenPrinting repository.
- Installs the Ricoh OpenPrinting Package (
openprinting-ppds-postscript-ricoh
) and unzips the PPDs. - Installs HPLIP (HP Linux Imaging and Printing), including a proprietary plugin.
- Copies specified PPDs from a designated folder to
/opt/share/ppd
.
Managing Printers
- Removes any printers that are set to be deleted first.
- Installs the printers and classes defined in the variables
cups_printer_list
andcups_class_list
.- Check the cups_printer_list and cups_class_list documentation for details on how to set these up.
- Uses the cups_lpadmin module, which includes usage documentation.
Requirements
- Ansible version 2.1 or higher.
- Supported guest machines include Debian (stretch, jessie, wheezy) and Ubuntu (xenial, trusty, precise).
Additional Tasks Outside This Role's Scope
- Opening required CUPS ports (515, 631, 9100) in the firewall.
- You can modify
cups__debops_ferm_dependent_rules
(in defaults) if using debops.ferm for firewall management.
- You can modify
Default Variables
These variables can be changed or used as-is:
Installation and Configuration
cups_lpadmin_users
: Users to add to the CUPS admin group (default is root).cups_lpd
: To install and configure cups-lpd (default isTrue
).cups_sysadmins_email
: Email for the cupsd.conf template (default issysadmins@ansible_fqdn
).- Various settings for firewall rules and xinetd configurations.
PPD Installation
cups_ppd_files_to_be_copied
: Source folder for .ppd files (default is none).cups_hplip
: Install HPLIP (default isTrue
).cups_ricoh_openprinting
: Install Ricoh drivers/PPDs (default isTrue
).- Settings related to OpenPrinting repository.
Printer and Class Installation
cups_printer_list
: A list of printers with the necessary info for installation.cups_class_list
: A list of classes with the necessary info for installation.- Flags to control printer sharing and how to handle missing attributes.
General Role Operations
cups_packages_to_install
: Packages to install (default iscups, cups-pdf
).- Various paths and permissions for CUPS configuration files.
- Temporary location for scripts (
/tmp/cups-ansible
).
This role simplifies the installation and configuration of printing services on Unix-like systems using Ansible, making printer management easier for system administrators.