Files
ansible/playbooks/srv-print.yml
2022-02-27 00:41:49 +01:00

63 lines
1.9 KiB
YAML

- hosts: srv-print
become: yes
tasks:
- name: create admin user
ansible.builtin.user:
user: admin
state: present
shell: /bin/bash
groups: sudo
- name: add admin ssh-key
ansible.posix.authorized_key:
user: admin
state: present
key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCsLI18nShd47L6o4dL2sIbhJAlWdXXc7BBSqhslTBMVziY6OBazW2jxxU0eN+Wi3RYEuOUd3xt6f56m6NgB96MxvRbfhD06FCetrEzEX/k7yWRVlvyMOSX0RjTr2UWPqOpXmLvbpOvTX4m4+rhpXlXJ1FB/jiZGNYvQEXot8PFTkMBdP0rHsdXiHhJvJy8Y/jDoErrCrK+Yger9ziCeskr3t/KET1nD6e/g4lQwVr7YftMw9s/0RiSVU4VQnUHjMiyXMpg8SD54YkmaQ8TJ14dQ3LVvMjXNGhg3fmmmxQMWot64oLe5HvNJigmKDfYxUzQuX8Ba2zAcnvHkLp/RpVB krumel@YatagarasuDrive"
- name: install cups
apt:
pkg:
- cups
state: present
update_cache: yes
- name: download the printer driver binary
get_url:
url: https://krumel.moe/media/ansible/uld_V1.00.39_01.17.tar.gz
dest: /tmp/
- name: extract the printer driver binary
unarchive:
src: /tmp/uld_V1.00.39_01.17.tar.gz
dest: /tmp/
remote_src: yes
- name: remove prompts from the installer
replace:
path: /tmp/uld/noarch/pre_install.sh
regexp: 'read'
replace: 'echo'
- name: remove eula prompt from driver installer
replace:
path: /tmp/uld/noarch/pre_install.sh
regexp: 'EULA_PAGER\="\$\{PAGER\:\-`which more`\}"'
replace: 'exit 0'
- name: run the printer driver installer
shell: bash /tmp/uld/install.sh
- name: allow access to cups from network
replace:
path: /etc/cups/cupsd.conf
regexp: 'Listen localhost:631'
replace: 'Listen 0.0.0.0:631'
register: cupsd_mod1
- name: configure cups for remote access
shell: cupsctl --remote-admin --remote-any --share-printers
- name:
service:
name: cups
state: restarted