Improve ansible code so that ansibe-lint shows fewer errors

This commit is contained in:
Raphael Dannecker 2025-03-24 07:33:56 +01:00
parent e8ef744f59
commit f965f4466c
23 changed files with 228 additions and 189 deletions

View file

@ -1,26 +1,25 @@
---
- name: Install cups
apt:
ansible.builtin.apt:
name:
- cups
state: latest
- name: Disable cups printer browsing
lineinfile:
ansible.builtin.lineinfile:
dest: /etc/cups/cupsd.conf
regexp: '^(Browsing ).*'
line: '\1No'
backrefs: yes
backrefs: true
- name: Listen on all Interfaces
lineinfile:
ansible.builtin.lineinfile:
dest: /etc/cups/cupsd.conf
line: 'Listen *:631'
regexp: '^Listen localhost'
state: present
- name: Allow access from localhost and from VM
blockinfile:
ansible.builtin.blockinfile:
dest: /etc/cups/cupsd.conf
block: |
Allow localhost
@ -33,7 +32,7 @@
- "/admin"
- name: Allow group role-teacher to manage printers
lineinfile:
ansible.builtin.lineinfile:
dest: /etc/cups/cups-files.conf
line: 'SystemGroup root lpadmin role-teacher'
regexp: '^SystemGroup'
@ -44,24 +43,25 @@
ansible.builtin.systemd:
name: cups-browsed.service
state: stopped
enabled: no
enabled: false
- name: Install install-printers.sh
template:
ansible.builtin.template:
src: install-printers.sh.j2
dest: /usr/local/bin/install-printers.sh
mode: 0755
mode: '0755'
- name: Install lmn-install-printers sudoers
copy:
ansible.builtin.copy:
src: 90-lmn-install-printers
dest: /etc/sudoers.d/
mode: 0660
mode: '0660'
owner: root
group: root
- name: Run printer script from /etc/profile.d/
copy:
ansible.builtin.copy:
dest: /etc/profile.d/lmn-printer.sh
mode: '0644'
content: |
[[ "${UID}" -gt 10000 ]] && (sudo /usr/local/bin/install-printers.sh > /dev/null &)