--- - block: - name: Install cups yum: name: "{{ cups_packages | default(__cups_packages) }}" state: present notify: __cupsd_restart - name: Install extra packages yum: name: "{{ cups_packages_extra }}" state: present notify: __cupsd_restart - name: Deploy global config files template: src: "{{ item }}.j2" dest: "/{{ item }}" mode: 0640 loop: - etc/cups/cupsd.conf - etc/cups/cups-files.conf notify: __cupsd_restart - name: Create user '{{ cups_admin_username }}' user: comment: Cups Admin name: "{{ cups_admin_username }}" password: "{{ cups_admin_password | password_hash('sha512', inventory_hostname) }}" groups: printadmin - name: Update pamd rule's control in /etc/pam.d/cups pamd: name: cups type: "{{ item.type }}" control: "{{ item.control }}" module_path: "{{ item.module }}" module_arguments: "{{ item.arguments | default(omit) }}" new_module_path: "{{ item.new_module }}" loop: "{{ __pam_config }}" - name: Open ports in iptables iptables_raw: name: "{{ item.name }}" rules: "{{ item.rules }}" state: "{{ item.state }}" weight: "{{ item.weight | default(omit) }}" table: "{{ item.table | default(omit) }}" loop: "{{ cups_open_ports }}" loop_control: label: "{{ item.name }}" when: cups_iptables_enabled become: True become_user: root