Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
# 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 | 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 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 is defined
- cups_status != 'masked'
register: ret_mask_cups
changed_when: ret_mask_cups.rc != 0