Skip to content

Fix typo: except -> expect. #13

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

Open
wants to merge 4 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
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* Installs `cups-lpd` if variables allow (see below):
* Creates a user account which will run the cups-lpd process.
* Installs `xinetd` to run cups-lpd as a service. Uses the cups-lpd template file to create the final xinetd config.
* Configuring CUPS:
* If templates for cupsd.conf, cups-browsed.conf and snmp.conf are provided they'll be built and copied over
* Configuring CUPS:
* If templates for cupsd.conf, cups-browsed.conf and snmp.conf are provided they'll be built and copied over
* If SSL certs are provided it'll copy them over to the proper location.

### Install PPDs
Expand All @@ -19,17 +19,17 @@
* Install Ricoh OpenPrinting Package - `openprinting-ppds-postscript-ricoh`
* Also unzip the PPDs it installs as the package installs them as gzip files in `/opt/OpenPrinting-Ricoh/ppds/Ricoh`
* Installs HPLIP:
* Also installs the HP proprietary plugin using an except script.
* Also installs the HP proprietary plugin using an expect script.
* Copies over PPDs from the folder if specified in `cups_ppd_files_to_be_copied` to `/opt/share/ppd`

### Install Printers
* Any printers defined to be removed will be removed first.
* Install Printers listed in the `cups_printer_list` variable and then installs classes listed in the `cups_class_list`
* See [cups_printer_list and cups_class_list](tasks/printer_install.yml) to see how to define each printer and class object in the variable `cups_printer_list` and `cups_class_list` respectively.
* This uses the [cups_lpadmin](library/cups_lpadmin.py) module. There's documentation/comments within it on how it can be used.
* cups\_lpadmin is a direct copy from [HP41.ansible-modules-extra](https://github.com/HP41/ansible-modules-extras)/system/cups\_lpadmin. Once it's merged upstream, it'll be removed from here.
## Requirements
* cups\_lpadmin is a direct copy from [HP41.ansible-modules-extra](https://github.com/HP41/ansible-modules-extras)/system/cups\_lpadmin. Once it's merged upstream, it'll be removed from here.

## Requirements
* Ansible >= 2.1
* Guest machine: Debian
- stretch
Expand All @@ -50,7 +50,7 @@
* `cups_lpd`: Whether to install and setup cups-lpd - Default=`True`
* `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
* /etc/xinetd.d/cups-lpd
* `cups_lpd_usn`: 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.
Expand Down Expand Up @@ -91,4 +91,4 @@
* `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_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`
16 changes: 8 additions & 8 deletions tasks/cups_cleanup.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
- block:
- block:
- name: Delete {{ cups_tmp_location }}
file:
path: "{{cups_tmp_location}}"
state: absent

# As grep was used in the initial command whos output is registered as cups_papercut_expect_pkgs_already_installed.
# The results dict will contain the results if the package already existed or not. If there output is none or the
# command failed to find "Install ok installed" then it means the package wasn't installed beforehand and therfore
# can be uninstalled after the precessing of this script.
# As grep was used in the initial command whose output is registered as cups_papercut_expect_pkgs_already_installed.
# The results dict will contain the results if the package already existed or not. If there output is none or the
# command failed to find "Install ok installed" then it means the package wasn't installed beforehand and therefore
# can be uninstalled after the processing of this script.
- name: Uninstall the expect pacakges if installed before
apt: name={{ item.0 }} state=absent
when: (item.1|failed) or (item.1.stdout == "")
when: item.1 is failed or (item.1.stdout == "")
with_together:
- "{{cups_expect_pkgs}}"
- "{{cups_expect_pkgs_already_installed.results}}"
ignore_errors: True

ignore_errors: True
2 changes: 1 addition & 1 deletion tasks/cups_pre_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

# If the output is none or the command failed to find "install ok installed" then it means the package wasn't installed beforehand
- name: Check and register if expect related packages are already installed.
command: dpkg -s {{item}} | grep 'install ok installed'
shell: dpkg -s {{item}} | grep 'install ok installed'
register: cups_expect_pkgs_already_installed
with_items:
- "{{cups_expect_pkgs}}"
Expand Down
4 changes: 2 additions & 2 deletions tasks/ppd_hp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
dest: "{{cups_tmp_location}}/hp-plugin-install.exp"
mode: a+rx

- name: Installing HP Plugin using an except script to avoid user interaction
command: "{{cups_tmp_location}}/hp-plugin-install.exp"
- name: Installing HP Plugin using an expect script to avoid user interaction
command: "{{cups_tmp_location}}/hp-plugin-install.exp"