- hosts: srv-print become: yes tasks: - name: create admin user ansible.builtin.user: user: admin state: present shell: /bin/bash groups: sudo - name: add admin ssh-key ansible.posix.authorized_key: user: admin state: present key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCsLI18nShd47L6o4dL2sIbhJAlWdXXc7BBSqhslTBMVziY6OBazW2jxxU0eN+Wi3RYEuOUd3xt6f56m6NgB96MxvRbfhD06FCetrEzEX/k7yWRVlvyMOSX0RjTr2UWPqOpXmLvbpOvTX4m4+rhpXlXJ1FB/jiZGNYvQEXot8PFTkMBdP0rHsdXiHhJvJy8Y/jDoErrCrK+Yger9ziCeskr3t/KET1nD6e/g4lQwVr7YftMw9s/0RiSVU4VQnUHjMiyXMpg8SD54YkmaQ8TJ14dQ3LVvMjXNGhg3fmmmxQMWot64oLe5HvNJigmKDfYxUzQuX8Ba2zAcnvHkLp/RpVB krumel@YatagarasuDrive" - name: install cups and printer drivers apt: pkg: - cups - printer-driver-splix state: present update_cache: yes - name: allow access to cups from network replace: path: /etc/cups/cupsd.conf regexp: 'Listen localhost:631' replace: 'Listen 0.0.0.0:631' register: cupsd_mod1 - name: allow access to the webinterface blockinfile: path: /etc/cups/cupsd.conf insertafter: '' insertbefore: '' block: | Order allow,deny Allow all register: cupsd_mod2 - name: service: name: cups state: restarted when: cupsd_mod1.changed | cupsd_mod2.changed