Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix jinja 'failed' filter missing & hplip expect script; merge changes from many other contribs. #12

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.vagrant/*
**/*~
**/*.swp
/meta/.galaxy_install_info
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
- xenial
- trusty
- precise
* Guest machine: CentOS
- 7.4

## Possible additional tasks that are not part of this role's responsibilities.
* Opening the necessary CUPS ports - 515(LPR), 631(IPP/IPPS), 9100(direct IP) through the firewall.
Expand All @@ -51,7 +53,7 @@
* `cups_sysadmins_email`: The email that'll be used to build the cupsd.conf template - Default=`sysadmins@ansible_fqdn`
* `cups__debops_ferm_dependent_rules`: Default simple rules to open up ports (515, 631, 9100) through firewall that can be referenced when using [debops.ferm](https://github.com/debops/ansible-ferm) role.
* /etc/xinetd.d/cups-lpd
* `cups_lpd_usn`: The username with which it'll run the cups-lpd process (through xinetd) - Default=`cupslpd`
* `cups_lpd_user`: The username with which it'll run the cups-lpd process (through xinetd) - Default=`cupslpd`
* Optional templates:
* They could've been setup as a simple file copy but accessing and adding ansible variables into it will not be possible. With this ansible\_managed, ansible\_fqdn, etc are accessible. The templates could also be simple text files with no variable declaration and it'll get copied over.
* `cups_cupsd_conf_template`: For /etc/cups/cupsd.conf
Expand All @@ -65,7 +67,8 @@
* `cups_openprinting_apt_required`: This is defined as a ternary. It controls if the OpenPrinting APT key and repo is added based on Ricoh drivers are being installed or not. It can be easily overriden to your value.
* `cups_openprinting_apt_key_id`: The APT key id to obtain from keyserver below. Default=24CBF5474CFD1E2F
* `cups_openprinting_key_server`: The keyserver to acquire the key from for the below repo - Default=keyserver.ubuntu.com
* `cups_openprinting_repo`: The OpenPrinting Repo to add - Default="deb http://www.openprinting.org/download/printdriver/debian/ lsb3.2 main"
* `cups_openprinting_apt_repo`: The OpenPrinting Repo to add for Debian / Ubuntu - Default="deb http://www.openprinting.org/download/printdriver/debian/ lsb3.2 main"
* `cups_openprinting_yum_repo`: The OpenPrinting Repo to add for RedHat / CentOS - Default="http://www.openprinting.org/download/printdriver/components/lsb3.2/main/RPMS"


### Installation of Printers and classes:
Expand All @@ -83,12 +86,12 @@
* `cups_packages_to_install`: The CUPS packages to install. This can be overridden for a specific package version if needed - Default=`cups, cups-pdf`
* `cups_xinetd_location`: The location of xinet.d files - Default=`/etc/xinetd.d`
* `cups_tmp_location`: Temp location that this role uses for copying files and running scripts. Location is created if it doesn't exist - Default=`/tmp/cups-ansible`
* `cups_admin_grp`: The group that has admin access to CUPS. This is referenced when adding users (if defined) to CUPS admin roles - Default=`lpadmin`
* `cups_admin_group`: The group that has admin access to CUPS. This is referenced when adding users (if defined) to CUPS admin roles - Default=`lpadmin`
* `cups_services`: The CUPS service(s) that is referenced when starting and stopping CUPS service(s) for configuration purposes - Default=`cups`
* `cups_etc_location`: etc location of CUPS config - Default=`/etc/cups`
* `cups_etc_files_perms_owner`: Owner of files placed by this role under `cups_etc_location` - Default=`root`
* `cups_etc_files_perms_grp`: Group membership of files placed by this role under `cups_etc_location` - Default=`lp`
* `cups_etc_files_perms_group`: Group membership of files placed by this role under `cups_etc_location` - Default=`lp`
* `cups_etc_files_mode`: File mode of files placed by this role under `cups_etc_location` - Default=`0644`
* `cups_expect_pkgs`: The expect related packages that are installed for unattended installations of different expect scripts within this role - Default=`expect, python-pexpect`
* `cups_expect_packages`: The expect related packages that are installed for unattended installations of different expect scripts within this role - Debian-Default=`expect, python-pexpect , RedHat-Default=`expect, pexpect`
* `cups_ppd_shared_location`: The standard shared location where PPDs can be placed and CUPS will pick them up - Default=`/opt/share/ppd`
* `cups_ricoh_ppd_location`: The location where Ricoh PPDs from OpenPrinting are installed - Default=`/opt/OpenPrinting-Ricoh/ppds/Ricoh`
* `cups_ricoh_ppd_location`: The location where Ricoh PPDs from OpenPrinting are installed - Default=`/opt/OpenPrinting-Ricoh/ppds/Ricoh`
47 changes: 27 additions & 20 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
---
cups_lpadmin_users:
- root
cups_lpd: True
cups_lpd_usn: cupslpd
cups_lpd: true
cups_lpd_user: cupslpd

cups_sysadmins_email: "sysadmins@{{ansible_fqdn}}"
cups_sysadmins_email: "sysadmins@{{ ansible_fqdn }}"

cups_cupsd_conf_template: ""
cups_cups_browsed_conf_template: ""
cups_snmp_conf_template: ""

cups_hplip: True
cups_ricoh_openprinting_ppds: True
cups_openprinting_apt_required: "{{cups_ricoh_openprinting_ppds}}"
cups_hplip: false
cups_ricoh_openprinting_ppds: false
cups_openprinting_apt_required: "{{ cups_ricoh_openprinting_ppds }}"

# Debian Keys
cups_openprinting_apt_key_id: 24CBF5474CFD1E2F
cups_openprinting_key_server: keyserver.ubuntu.com
cups_openprinting_repo: "deb http://www.openprinting.org/download/printdriver/debian/ lsb3.2 main"
# Debian:
cups_openprinting_apt_repo: "deb http://www.openprinting.org/download/printdriver/debian/ lsb3.2 main"
# CentOS et al.
cups_openprinting_yum_repo: "http://www.openprinting.org/download/printdriver/components/lsb3.2/main/RPMS"
# Suse et al.
cups_openprinting_rpm_repo: "http://www.openprinting.org/download/printdriver/components/lsb3.2/main/RPMS"

cups_ppd_files_to_be_copied: ""

Expand All @@ -26,21 +32,21 @@ cups__debops_ferm_dependent_rules:
type: 'accept'
protocol: 'tcp'
dport: ['631', '515', '9100']
accept_any: True
accept_any: true

cups_purge_all_printers_and_classes: False
cups_purge_all_printers_and_classes: false

cups_printer_uri_prefix: ""

cups_printer_default_state: "present"
cups_printer_default_report_ipp_supplies: True
cups_printer_default_report_snmp_supplies: True
cups_printer_default_is_shared: True
cups_printer_default_enabled: True
cups_printer_default_report_ipp_supplies: true
cups_printer_default_report_snmp_supplies: true
cups_printer_default_is_shared: true
cups_printer_default_enabled: true
cups_printer_default_assign_cups_policy: "default"

cups_class_default_state: "present"
cups_class_default_is_shared: True
cups_class_default_is_shared: true

cups_printers_and_classes_to_be_removed: []
# - TEST
Expand All @@ -66,18 +72,19 @@ cups_class_list: []
cups_packages_to_install:
- cups
- cups-pdf

cups_xinetd_enabled: false
cups_xinetd_location: "/etc/xinetd.d"
cups_tmp_location: "/tmp/cups-ansible"
cups_admin_grp: lpadmin
cups_admin_group: lpadmin

cups_services:
- cups

cups_etc_location: "/etc/cups"
cups_etc_files_perms_owner: "root"
cups_etc_files_perms_grp: "lp"
cups_etc_files_perms_group: "lp"
cups_etc_files_mode: 0644

cups_expect_pkgs:
- "expect"
- "python-pexpect"
cups_ppd_shared_location: "/opt/share/ppd"
cups_ricoh_ppd_location: "/opt/OpenPrinting-Ricoh/ppds/Ricoh"
cups_ricoh_ppd_location: "/opt/OpenPrinting-Ricoh/ppds/Ricoh"
2 changes: 2 additions & 0 deletions files/hp-plugin-install.exp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ send -- "hp-plugin -i\r"
expect "Do you wish to download and re-install the plug-in? (y=yes*, n=no, q=quit) ?" { send -- "y\r" }
expect "Enter option (d=download*, p=specify path, q=quit) ?" { send -- "d\r" }
expect "Do you accept the license terms for the plug-in (y=yes*, n=no, q=quit) ?" { send -- "y\r" }
expect "Do you still want to install the plug-in" { send -- "n\r" }
expect "Network connection not detected" { expect eof }

# Finally exiting the shell created above.
expect ":" { send -- "exit\r" }
Expand Down
Loading