create printerlist.csv to inform VMs about available printers
This commit is contained in:
parent
ed7dadf612
commit
c99ec444f8
2 changed files with 26 additions and 1 deletions
|
@ -12,6 +12,26 @@
|
|||
line: '\1No'
|
||||
backrefs: yes
|
||||
|
||||
- name: Listen on VMBridge
|
||||
lineinfile:
|
||||
dest: /etc/cups/cupsd.conf
|
||||
line: 'Listen 192.168.122.1:631'
|
||||
insertafter: 'Listen localhost:631'
|
||||
state: present
|
||||
|
||||
- name: Allow access from localhost and from VM
|
||||
blockinfile:
|
||||
dest: /etc/cups/cupsd.conf
|
||||
block: |
|
||||
Allow localhost
|
||||
Allow 192.168.122.0/24
|
||||
insertafter: "<Location {{ item }}>"
|
||||
marker: "# {mark} ANSIBLE MANAGED BLOCK {{ item }}"
|
||||
state: present
|
||||
loop:
|
||||
- "/"
|
||||
- "/admin"
|
||||
|
||||
- name: Disable cups-browsed
|
||||
ansible.builtin.systemd:
|
||||
name: cups-browsed.service
|
||||
|
|
|
@ -23,6 +23,10 @@ for p in $installedprinters ; do
|
|||
fi
|
||||
done
|
||||
|
||||
## Prepare .printerlist.csv
|
||||
mkdir -p "/lmn/media/${SUDO_USER}"
|
||||
echo "Name;IppURL" > "/lmn/media/${SUDO_USER}/.printerlist.csv"
|
||||
|
||||
## Add all printers needed:
|
||||
for ps in $printservers ; do
|
||||
echo "Checking print server '$ps' for available printers:"
|
||||
|
@ -36,8 +40,9 @@ for ps in $printservers ; do
|
|||
echo "Adding print queue '$p'."
|
||||
timeout 10 lpadmin -p "$p" -E -v \
|
||||
"ipp://$ps/printers/$p" \
|
||||
-m everywhere || echo "Adding queue '$p' failed."
|
||||
-m "driverless:ipp://$ps/printers/$p" || echo "Adding queue '$p' failed."
|
||||
fi
|
||||
echo "$p;ipp://192.168.122.1/printers/$p" >> "/lmn/media/${SUDO_USER}/.printerlist.csv"
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
|
Loading…
Add table
Reference in a new issue