84 lines
2.5 KiB
YAML
84 lines
2.5 KiB
YAML
- hosts: srv-print
|
|
become: yes
|
|
tasks:
|
|
|
|
- name: user setup
|
|
block:
|
|
- 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: add the samsung uld driver repo
|
|
apt_repository:
|
|
repo: deb https://www.bchemnet.com/suldr/ debian extra
|
|
state: present
|
|
|
|
- name: install cups and some other required packages
|
|
apt:
|
|
pkg:
|
|
- cups
|
|
- printer-driver-splix
|
|
- nginx
|
|
- libnginx-mod-http-lua
|
|
state: present
|
|
update_cache: yes
|
|
|
|
- name: cups setup
|
|
block:
|
|
- name: allow access to cups from network
|
|
replace:
|
|
path: /etc/cups/cupsd.conf
|
|
regexp: 'Listen localhost:631'
|
|
replace: 'Listen 0.0.0.0:631'
|
|
|
|
- name: configure cups for remote access
|
|
shell: cupsctl --remote-admin --remote-any --share-printers
|
|
|
|
- name: restart cups
|
|
service:
|
|
name: cups
|
|
state: restarted
|
|
|
|
- name: configure nginx to scan images on request
|
|
block:
|
|
- name: copy config to sites-available
|
|
copy:
|
|
src: templates/scan_image.conf
|
|
dest: /etc/nginx/sites-available/
|
|
|
|
- name: link to sites-enabled
|
|
file:
|
|
src: /etc/nginx/sites-available/scan_image.conf
|
|
dest: /etc/nginx/sites-enabled/scan_image.conf
|
|
state: link
|
|
|
|
- name: ensure no default site is sites-enabled
|
|
file:
|
|
path: /etc/nginx/sites-enabled/default
|
|
state: absent
|
|
|
|
- name: create scan directory and give www-data rights
|
|
file:
|
|
path: /srv/scans/
|
|
state: directory
|
|
owner: www-data
|
|
|
|
- name: copy htpasswd
|
|
copy:
|
|
src: templates/htpasswd_scan
|
|
dest: /etc/nginx/htpasswd/
|
|
|
|
- name: restart nginx
|
|
service:
|
|
name: nginx
|
|
state: restarted
|