hp41 / ansible-cups Goto Github PK
View Code? Open in Web Editor NEWAnsible role to install and configure CUPS, assist with installing PPDs and install printers/classes
License: MIT License
Ansible role to install and configure CUPS, assist with installing PPDs and install printers/classes
License: MIT License
Pull request coming...
With Ubuntu 16.04 using
ansible 2.3.0.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]
Here's the play item which has errored, when I run ansible-playbook with -vvv
TASK [HP41.cups : Install printers using cups_lpadmin] ******************************************************************************************
task path: /etc/ansible/roles/HP41.cups/tasks/printer_and_class_install.yml:14
Using module file /etc/ansible/roles/HP41.cups/library/cups_lpadmin.py
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c 'echo ~ && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1494079292.48-254030271278802 `" && echo ansible-tmp-1494079292.48-254030271278802="` echo /root/.ansible/tmp/ansible-tmp-14940
79292.48-254030271278802 `" ) && sleep 0'
<localhost> PUT /tmp/tmpJwH5cU TO /root/.ansible/tmp/ansible-tmp-1494079292.48-254030271278802/cups_lpadmin.py
<localhost> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1494079292.48-254030271278802/ /root/.ansible/tmp/ansible-tmp-1494079292.48-254030271278802/cups_lpadmin.py && sleep 0'
<localhost> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1494079292.48-254030271278802/cups_lpadmin.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1494079292.48-254030271278802/" > /dev/null 2>&1 && slee
p 0'
The full traceback is:
Traceback (most recent call last):
File "/tmp/ansible_ji0fa4/ansible_module_cups_lpadmin.py", line 1187, in <module>
main()
File "/tmp/ansible_ji0fa4/ansible_module_cups_lpadmin.py", line 1180, in main
result_info = cups_command.start_process()
File "/tmp/ansible_ji0fa4/ansible_module_cups_lpadmin.py", line 1104, in start_process
self.printer_install()
File "/tmp/ansible_ji0fa4/ansible_module_cups_lpadmin.py", line 1040, in printer_install
if self.exists_self() and not self.printer_check_cups_options():
File "/tmp/ansible_ji0fa4/ansible_module_cups_lpadmin.py", line 856, in printer_check_cups_options
'printer-make-and-model': self._printer_get_make_and_model(),
File "/tmp/ansible_ji0fa4/ansible_module_cups_lpadmin.py", line 593, in _printer_get_make_and_model
installed_drivers = self._printer_get_installed_drivers()
File "/tmp/ansible_ji0fa4/ansible_module_cups_lpadmin.py", line 542, in _printer_get_installed_drivers
curr[kv[0]] = kv[1]
TypeError: 'itertools.imap' object has no attribute '__getitem__'
failed: [localhost] (item={u'info': u'HP Officejet 6500 e709n', u'name': u'HPPrinter', u'driver': u'drv:///hpcups.drv/hp-officejet_6500_e709n.ppd', u'uri': u'hp:/net/Officejet_6500_E709n?ip=192.168.1.55', u'default_pri
nter': True, u'location': u'Playroom', u'shared': True}) => {
"failed": true,
"item": {
"default_printer": true,
"driver": "drv:///hpcups.drv/hp-officejet_6500_e709n.ppd",
"info": "HP Officejet 6500 e709n",
"location": "Playroom",
"name": "HPPrinter",
"shared": true,
"uri": "hp:/net/Officejet_6500_E709n?ip=192.168.1.55"
},
"module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_ji0fa4/ansible_module_cups_lpadmin.py\", line 1187, in <module>\n main()\n File \"/tmp/ansible_ji0fa4/ansible_module_cups_lpadmin.py\"
, line 1180, in main\n result_info = cups_command.start_process()\n File \"/tmp/ansible_ji0fa4/ansible_module_cups_lpadmin.py\", line 1104, in start_process\n self.printer_install()\n File \"/tmp/ansible_ji0fa4
/ansible_module_cups_lpadmin.py\", line 1040, in printer_install\n if self.exists_self() and not self.printer_check_cups_options():\n File \"/tmp/ansible_ji0fa4/ansible_module_cups_lpadmin.py\", line 856, in printe
r_check_cups_options\n 'printer-make-and-model': self._printer_get_make_and_model(),\n File \"/tmp/ansible_ji0fa4/ansible_module_cups_lpadmin.py\", line 593, in _printer_get_make_and_model\n installed_drivers =
self._printer_get_installed_drivers()\n File \"/tmp/ansible_ji0fa4/ansible_module_cups_lpadmin.py\", line 542, in _printer_get_installed_drivers\n curr[kv[0]] = kv[1]\nTypeError: 'itertools.imap' object has no attr
ibute '__getitem__'\n",
"module_stdout": "",
"msg": "MODULE FAILURE",
"rc": 0
}
This is the line I get when I run lpinfo -m | grep e709n
drv:///hpcups.drv/hp-officejet_6500_e709n.ppd HP Officejet 6500 e709n, hpcups 3.16.3
name: Base Configuration
hosts: zfs11
become: True
vars:
cups_purge_all_printers_and_classes: True
cups_printers_and_classes_to_be_removed:
cups_openprinting_apt_required:
cups_ricoh_openprinting_ppds: False
roles:
It installs the printer but not the appropriate ppd. lpoptions -l reports no ppd.
I tried adding these lines
driver: ppd
model: 'hplip:0/ppd/hplip/HP/hp-laserjet_2200-ps.ppd'
#model: 'drv:///hpcups.drv/hp-laserjet_2200_series.ppd'
these came from lpinfo -m
either version of the model variable gives "ppd cannot be copied"
Can you advise a solution please?
Best wsihes
Terry
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.