diff --git a/hosts b/hosts
index ea112b0..54d2645 100644
--- a/hosts
+++ b/hosts
@@ -39,6 +39,10 @@ all:
- uuid: 649a9370-5cad-4553-93c8-cf0af25208dd
name: jirost
level: 4
+ cups:
+ hosts:
+ cups:
+ ansible_host: cups.local
k3s:
children:
k3s-server:
@@ -73,6 +77,7 @@ all:
k3s:
plex:
minecraft-server:
+ cups:
vars:
ansible_user: ansible
ansible_password: !vault |
diff --git a/playbook.yml b/playbook.yml
index 7019387..13fa960 100644
--- a/playbook.yml
+++ b/playbook.yml
@@ -24,4 +24,8 @@
- hosts: minecraft-server
roles:
- - minecraft-server
\ No newline at end of file
+ - minecraft-server
+
+- hosts: cups
+ roles:
+ - cups
\ No newline at end of file
diff --git a/roles/cups/handlers/main.yaml b/roles/cups/handlers/main.yaml
new file mode 100644
index 0000000..e25b692
--- /dev/null
+++ b/roles/cups/handlers/main.yaml
@@ -0,0 +1,5 @@
+- name: Restart cups
+ service:
+ name: cups
+ enabled: true
+ state: restarted
\ No newline at end of file
diff --git a/roles/cups/tasks/main.yaml b/roles/cups/tasks/main.yaml
new file mode 100644
index 0000000..1dd44b5
--- /dev/null
+++ b/roles/cups/tasks/main.yaml
@@ -0,0 +1,50 @@
+- name: Install cups and drivers
+ apt:
+ name:
+ - cups
+ - avahi-daemon
+ - hplip # https://openprinting.org/printer/HP/HP-LaserJet_1010
+
+- name: Listen on all interfaces
+ lineinfile:
+ path: /etc/cups/cupsd.conf
+ regex: ^Listen .*:631
+ line: Listen *:631
+ notify: Restart cups
+
+- name: Allow printer sharing via avahi
+ lineinfile:
+ path: /etc/cups/cupsd.conf
+ regex: ^Browsing
+ line: Browsing yes
+ notify: Restart cups
+
+- name: Allow printer sharing via ipp
+ blockinfile:
+ path: /etc/cups/cupsd.conf
+ marker: "## {mark} PRINTER SHARING"
+ block: |
+
+ Order allow,deny
+ Allow localhost
+ Allow @LOCAL
+
+ notify: Restart cups
+
+- name: Allow remote administration
+ blockinfile:
+ path: /etc/cups/cupsd.conf
+ marker: "## {mark} REMOTE ADMINSTRATION"
+ block: |
+ DefaultEncryption IfRequested
+
+ Order allow,deny
+ Allow from @LOCAL
+
+
+ AuthType Basic
+ Require user @SYSTEM
+ Order allow,deny
+ Allow from @LOCAL
+
+ notify: Restart cups
\ No newline at end of file