diff --git a/defaults/main.yml b/defaults/main.yml index d1294a8..c52672d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,5 +1,5 @@ --- -cups_version: 2.3.1 +cups_version: 2.3.3op2 # @var cups_packages_extra:description: > # Install dependencies or custom driver packages @@ -16,8 +16,8 @@ cups_selinux_restorecon: [] cups_admin_group: printadmin cups_admin_users: - - name: 'cupsadm' - password: 'secure' + - name: "cupsadm" + password: "secure" cups_bind_url: - localhost:631 diff --git a/handlers/main.yml b/handlers/main.yml index 5248ec1..2377e45 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,7 +1,7 @@ --- - name: Restart service service: - name: org.cups.cupsd + name: cups state: restarted daemon_reload: yes enabled: yes diff --git a/molecule/centos7/tests/test_default.py b/molecule/centos7/tests/test_default.py index 10d41ee..d693112 100644 --- a/molecule/centos7/tests/test_default.py +++ b/molecule/centos7/tests/test_default.py @@ -8,7 +8,7 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( def test_cups_running_and_enabled(host): - cups = host.service("org.cups.cupsd") + cups = host.service("cups") assert cups.is_running assert cups.is_enabled diff --git a/molecule/rocky8/tests/test_default.py b/molecule/rocky8/tests/test_default.py index 10d41ee..d693112 100644 --- a/molecule/rocky8/tests/test_default.py +++ b/molecule/rocky8/tests/test_default.py @@ -8,7 +8,7 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( def test_cups_running_and_enabled(host): - cups = host.service("org.cups.cupsd") + cups = host.service("cups") assert cups.is_running assert cups.is_enabled diff --git a/tasks/install.yml b/tasks/install.yml index fe7c9c9..276aba9 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -3,6 +3,7 @@ - name: Install cups package: name: "{{ cups_packages | default(__cups_packages) }}" + disable_gpg_check: yes state: present notify: __cupsd_restart @@ -31,12 +32,5 @@ module_arguments: "{{ item.arguments | default(omit) }}" new_module_path: "{{ item.new_module }}" loop: "{{ __pam_config }}" - - - name: Replace default systemd unit - template: - src: "etc/systemd/system/org.cups.cupsd.service.j2" - dest: "/etc/systemd/system/org.cups.cupsd.service" - mode: 0640 - notify: __cupsd_restart become: True become_user: root diff --git a/tasks/main.yml b/tasks/main.yml index 2f0990f..1caf387 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,4 +1,16 @@ --- +- include_vars: "{{ var_files }}" + vars: + var_files: "{{ lookup('first_found', params, errors='ignore') }}" + params: + files: + - "{{ ansible_lsb.id | default('') | lower }}.yml" + - "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version }}.yml" + - "{{ ansible_os_family | lower }}.yml" + paths: + - "vars" + when: var_files + - include_tasks: prepare.yml - include_tasks: install.yml - include_tasks: selinux.yml diff --git a/tasks/post_tasks.yml b/tasks/post_tasks.yml index e63eedf..799f25f 100644 --- a/tasks/post_tasks.yml +++ b/tasks/post_tasks.yml @@ -1,7 +1,7 @@ --- - name: Ensure cups service is up and running service: - name: org.cups.cupsd + name: cups state: started daemon_reload: yes enabled: yes diff --git a/templates/etc/cups/cupsd.conf.j2 b/templates/etc/cups/cupsd.conf.j2 index 64f756a..633b675 100644 --- a/templates/etc/cups/cupsd.conf.j2 +++ b/templates/etc/cups/cupsd.conf.j2 @@ -14,6 +14,12 @@ DefaultEncryption Never LogLevel {{ cups_log_level | lower }} PageLogFormat +# Specifies the maximum size of the log files before they are rotated. The value "0" disables log rotation. +MaxLogSize 1m + +# Default error policy for printers +ErrorPolicy stop-printer + # Only listen for connections from the local machine. {% for item in cups_bind_url %} Listen {{ item }} @@ -94,7 +100,7 @@ WebInterface Yes Order deny,allow - # Only the owner or an administrator can cancel or authenticate a job... + # Only the owner or an administrator can cancel or authenticate a job... Require user @OWNER @SYSTEM Order deny,allow @@ -132,7 +138,7 @@ WebInterface Yes Order deny,allow - # All printer operations require a printer operator to authenticate... + # All printer operations require a printer operator to authenticate... AuthType Default Require user @SYSTEM diff --git a/templates/etc/systemd/system/org.cups.cupsd.service.j2 b/templates/etc/systemd/system/org.cups.cupsd.service.j2 deleted file mode 100644 index e84694b..0000000 --- a/templates/etc/systemd/system/org.cups.cupsd.service.j2 +++ /dev/null @@ -1,16 +0,0 @@ -#jinja2: lstrip_blocks: True -{{ ansible_managed | comment }} -[Unit] -Description=CUPS Scheduler -Documentation=man:cupsd(8) -After=sssd.service network.target -Wants=network.target - -[Service] -ExecStart=/usr/sbin/cupsd -l -Type=simple -Restart=on-failure - -[Install] -Also=org.cups.cupsd.socket org.cups.cupsd.path -WantedBy=printer.target diff --git a/vars/main.yml b/vars/main.yml index 6f9bb10..862041b 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,10 +1,10 @@ --- __cups_download_url: https://gitea.rknet.org/rpmbuild/cups/releases/download/v{{ cups_version }} __cups_packages: - - "{{ __cups_download_url }}/cups-{{ cups_version }}-0.x86_64.rpm" - - "{{ __cups_download_url }}/cups-devel-{{ cups_version }}-0.x86_64.rpm" - - "{{ __cups_download_url }}/cups-libs-{{ cups_version }}-0.x86_64.rpm" - - "{{ __cups_download_url }}/cups-lpd-{{ cups_version }}-0.x86_64.rpm" + - "{{ __cups_download_url }}/cups-{{ cups_version }}-0.el{{ ansible_distribution_major_version }}.x86_64.rpm" + - "{{ __cups_download_url }}/cups-devel-{{ cups_version }}-0.el{{ ansible_distribution_major_version }}.x86_64.rpm" + - "{{ __cups_download_url }}/cups-libs-{{ cups_version }}-0.el{{ ansible_distribution_major_version }}.x86_64.rpm" + - "{{ __cups_download_url }}/cups-lpd-{{ cups_version }}-0.el{{ ansible_distribution_major_version }}.x86_64.rpm" __pam_config: - type: "auth"