Newer
Older
---
# tasks file for disabling CUPS on target system
- name: DISABLE CUPS | Populate service facts
ansible.builtin.service_facts:
- name: DISABLE CUPS | Setting fact from cups status
ansible.builtin.set_fact:
cups_status: "{{ ansible_facts.services['cups.service'].status }}"
when: ansible_facts.services['cups.service'].status is defined
- name: DISABLE CUPS | DEBUG -> Print cups_status
ansible.builtin.debug:
msg: "cups_status: {{ cups_status }}"
when: c3infodesk_printer_host_cups_disable_debug | bool
- name: DISABLE CUPS | Stop the running CUPS on target
ansible.builtin.command:
cmd: systemctl stop cups
become: true
when:
- cups_status is defined
- cups_status != 'masked'
register: ret_stop_cups
changed_when: ret_stop_cups.rc != 0
- name: DISABLE CUPS | Disable the running CUPS on target
ansible.builtin.command:
cmd: systemctl disable cups
become: true
# when: cups_status != 'masked'
when:
- cups_status is defined
- cups_status != 'masked'
register: ret_disable_cups
changed_when: ret_disable_cups.rc != 0
- name: DISABLE CUPS | Mask the running CUPS on target
ansible.builtin.command:
cmd: systemctl mask cups
become: true
# when: cups_status != 'masked'
when:
- cups_status is defined
- cups_status != 'masked'
register: ret_mask_cups
changed_when: ret_mask_cups.rc != 0