diff --git a/README.md b/README.md index d41bc60..caee6ba 100644 --- a/README.md +++ b/README.md @@ -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 @@ -19,7 +19,7 @@ * 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 @@ -27,9 +27,9 @@ * 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 @@ -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. @@ -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` \ No newline at end of file +* `cups_ricoh_ppd_location`: The location where Ricoh PPDs from OpenPrinting are installed - Default=`/opt/OpenPrinting-Ricoh/ppds/Ricoh` diff --git a/tasks/cups_cleanup.yml b/tasks/cups_cleanup.yml index 58b895e..1f79e46 100644 --- a/tasks/cups_cleanup.yml +++ b/tasks/cups_cleanup.yml @@ -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 \ No newline at end of file + + ignore_errors: True diff --git a/tasks/cups_pre_install.yml b/tasks/cups_pre_install.yml index de6e646..bb59e95 100644 --- a/tasks/cups_pre_install.yml +++ b/tasks/cups_pre_install.yml @@ -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}}" diff --git a/tasks/ppd_hp.yml b/tasks/ppd_hp.yml index 62a030c..382eb42 100644 --- a/tasks/ppd_hp.yml +++ b/tasks/ppd_hp.yml @@ -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" \ No newline at end of file +- name: Installing HP Plugin using an expect script to avoid user interaction + command: "{{cups_tmp_location}}/hp-plugin-install.exp"