--- - name: Install client dependencies ansible.builtin.package: name: "{{ ['curl'] + (['jq'] if patchman_client_protocol | int == 2 else []) }}" state: present - name: Install cron ansible.builtin.package: name: "{{ 'cron' if ansible_facts['os_family'] == 'Debian' else 'cronie' }}" state: present when: patchman_cron_enabled | bool - name: Install patchman-client script ansible.builtin.copy: src: patchman-client dest: /usr/sbin/patchman-client owner: root group: root mode: "0755" notify: Send patchman report - name: Create /etc/patchman ansible.builtin.file: path: /etc/patchman state: directory owner: root group: root mode: "0755" - name: Configure patchman-client ansible.builtin.template: src: patchman-client.conf.j2 dest: /etc/patchman/patchman-client.conf owner: root group: root # keep the file private when it holds an API key mode: "{{ '0600' if patchman_client_api_key else '0644' }}" notify: Send patchman report # Writes the whole file so it replaces any hand-made /etc/cron.d/patchman-client - name: Schedule daily patchman report ansible.builtin.template: src: patchman-client.cron.j2 dest: /etc/cron.d/patchman-client owner: root group: root mode: "0644" when: patchman_cron_enabled | bool - name: Remove daily patchman report schedule ansible.builtin.file: path: /etc/cron.d/patchman-client state: absent when: not patchman_cron_enabled | bool