cups_server: ansible-lint fixes

This commit is contained in:
Timo Makinen 2022-10-30 16:37:41 +00:00
parent 3cdc1645f8
commit 588f9e8918
2 changed files with 30 additions and 31 deletions

View file

@ -1,6 +1,5 @@
--- ---
- name: Restart cups
- name: restart cups
ansible.builtin.service: ansible.builtin.service:
name: cups name: cups
state: restarted state: restarted

View file

@ -1,10 +1,10 @@
--- ---
- name: install cups packages - name: Install cups packages
ansible.builtin.package: ansible.builtin.package:
name: cups name: cups
state: installed state: installed
- name: create cups systemd override directory - name: Create cups systemd override directory
ansible.builtin.file: ansible.builtin.file:
path: /etc/systemd/system/cups.service.d path: /etc/systemd/system/cups.service.d
state: directory state: directory
@ -12,7 +12,7 @@
owner: root owner: root
group: "{{ ansible_wheel }}" group: "{{ ansible_wheel }}"
- name: configure cups keytab location - name: Configure cups keytab location
ansible.builtin.copy: ansible.builtin.copy:
dest: /etc/systemd/system/cups.service.d/keytab.conf dest: /etc/systemd/system/cups.service.d/keytab.conf
content: "[Service]\nEnvironment=KRB5_KTNAME=FILE:/etc/cups/cups.keytab\n" content: "[Service]\nEnvironment=KRB5_KTNAME=FILE:/etc/cups/cups.keytab\n"
@ -20,49 +20,49 @@
owner: root owner: root
group: "{{ ansible_wheel }}" group: "{{ ansible_wheel }}"
- name: enable gssapi authentication from cups - name: Enable gssapi authentication from cups
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/cups/cupsd.conf path: /etc/cups/cupsd.conf
regexp: "^DefaultAuthType .*" regexp: "^DefaultAuthType .*"
line: "DefaultAuthType Negotiate" line: "DefaultAuthType Negotiate"
notify: restart cups notify: Restart cups
- name: disable cups plain text port - name: Disable cups plain text port
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/cups/cupsd.conf path: /etc/cups/cupsd.conf
regexp: "^#?Listen (.*:)?631" regexp: "^#?Listen (.*:)?631"
line: "#Listen 631" line: "#Listen 631"
notify: restart cups notify: Restart cups
- name: set ssl listen port - name: Set ssl listen port
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/cups/cupsd.conf path: /etc/cups/cupsd.conf
line: "SSLListen 631" line: "SSLListen 631"
insertafter: "Listen /var/run/cups/cups.sock" insertafter: "Listen /var/run/cups/cups.sock"
notify: restart cups notify: Restart cups
- name: require tls 1.3 - name: Require tls 1.3
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/cups/cupsd.conf path: /etc/cups/cupsd.conf
line: "SSLOptions MinTLS1.3" line: "SSLOptions MinTLS1.3"
insertafter: "SSLListen 631" insertafter: "SSLListen 631"
notify: restart cups notify: Restart cups
- name: write all requests to cups access log - name: Write all requests to cups access log
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/cups/cupsd.conf path: /etc/cups/cupsd.conf
line: "AccessLogLevel all" line: "AccessLogLevel all"
insertafter: "LogLevel warn" insertafter: "LogLevel warn"
notify: restart cups notify: Restart cups
- name: disable printer advertisements - name: Disable printer advertisements
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/cups/cupsd.conf path: /etc/cups/cupsd.conf
regexp: "^BrowseLocalProtocols .*" regexp: "^BrowseLocalProtocols .*"
line: "BrowseLocalProtocols none" line: "BrowseLocalProtocols none"
notify: restart cups notify: Restart cups
- name: link private key - name: Link private key
ansible.builtin.file: ansible.builtin.file:
dest: "/etc/cups/ssl/{{ inventory_hostname }}.key" dest: "/etc/cups/ssl/{{ inventory_hostname }}.key"
src: "{{ tls_private }}/{{ inventory_hostname }}.key" src: "{{ tls_private }}/{{ inventory_hostname }}.key"
@ -71,9 +71,9 @@
group: "{{ ansible_wheel }}" group: "{{ ansible_wheel }}"
follow: false follow: false
force: true force: true
notify: restart cups notify: Restart cups
- name: link certificate - name: Link certificate
ansible.builtin.file: ansible.builtin.file:
dest: "/etc/cups/ssl/{{ inventory_hostname }}.crt" dest: "/etc/cups/ssl/{{ inventory_hostname }}.crt"
src: "{{ tls_certs }}/{{ inventory_hostname }}.crt" src: "{{ tls_certs }}/{{ inventory_hostname }}.crt"
@ -82,32 +82,32 @@
group: "{{ ansible_wheel }}" group: "{{ ansible_wheel }}"
follow: false follow: false
force: true force: true
notify: restart cups notify: Restart cups
- name: disable printer advertising - name: Disable printer advertising
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/cups/cupsd.conf path: /etc/cups/cupsd.conf
regexp: "^Browsing .*" regexp: "^Browsing .*"
line: "Browsing No" line: "Browsing No"
notify: restart cups notify: Restart cups
- name: disable unauthenticated access from cups - name: Disable unauthenticated access from cups
ansible.builtin.blockinfile: ansible.builtin.blockinfile:
path: /etc/cups/cupsd.conf path: /etc/cups/cupsd.conf
insertafter: "^<Location />" insertafter: "^<Location />"
block: | block: |
AuthType Default AuthType Default
Require user @foosh Require user @foosh
notify: restart cups notify: Restart cups
- name: configure cups admin group - name: Configure cups admin group
ansible.builtin.lineinfile: ansible.builtin.lineinfile:
path: /etc/cups/cups-files.conf path: /etc/cups/cups-files.conf
regexp: "^SystemGroup .*" regexp: "^SystemGroup .*"
line: "SystemGroup root sysadm" line: "SystemGroup root sysadm"
notify: restart cups notify: Restart cups
- name: add static files to cups web interface - name: Add static files to cups web interface
ansible.builtin.copy: ansible.builtin.copy:
dest: "/usr/share/cups/www/{{ item }}" dest: "/usr/share/cups/www/{{ item }}"
src: "{{ item }}" src: "{{ item }}"
@ -118,7 +118,7 @@
- logo.png - logo.png
- local.css - local.css
- name: create custom header for cups web interface - name: Create custom header for cups web interface
ansible.builtin.copy: ansible.builtin.copy:
dest: /usr/share/cups/templates/header.tmpl dest: /usr/share/cups/templates/header.tmpl
src: header.tmpl src: header.tmpl
@ -126,13 +126,13 @@
owner: root owner: root
group: "{{ ansible_wheel }}" group: "{{ ansible_wheel }}"
- name: disable cups socket service - name: Disable cups socket service
ansible.builtin.systemd: ansible.builtin.systemd:
name: cups.socket name: cups.socket
enabled: false enabled: false
state: stopped state: stopped
- name: enable cups service - name: Enable cups service
ansible.builtin.service: ansible.builtin.service:
name: cups name: cups
enabled: true enabled: true