Can now install VS Code. Download tars from github. Uses a vault for storing sudo passwords.
33 lines
1.7 KiB
YAML
33 lines
1.7 KiB
YAML
# Source https://sysadmin.info.pl/en/blog/disabling-the-cups-browsed-service-on-multiple-systems-using-ansible/
|
|
# Step 1: Check if systemctl is available (for systemd systems)
|
|
- name: Check if systemctl is available (neutral Python)
|
|
raw: "which systemctl"
|
|
register: systemctl_check
|
|
changed_when: False
|
|
ignore_errors: yes
|
|
- name: Check if cups-browsed service exists (systemd)
|
|
command: systemctl cat cups-browsed
|
|
register: cups_browsed_exists
|
|
changed_when: False
|
|
failed_when: cups_browsed_exists.rc not in [0, 1]
|
|
when: systemctl_check.rc == 0
|
|
ignore_errors: yes
|
|
- name: Stop cups-browsed service (systemd)
|
|
systemd:
|
|
name: cups-browsed
|
|
state: stopped
|
|
when: cups_browsed_exists is defined and cups_browsed_exists.rc is defined and cups_browsed_exists.rc == 0
|
|
- name: Disable cups-browsed service (systemd)
|
|
systemd:
|
|
name: cups-browsed
|
|
enabled: no
|
|
when: cups_browsed_exists is defined and cups_browsed_exists.rc is defined and cups_browsed_exists.rc == 0
|
|
- name: Display cups-browsed service status in JSON format
|
|
debug:
|
|
msg: |
|
|
{
|
|
"Machine": "{{ inventory_hostname }}",
|
|
"Systemd used": "{{ 'Yes' if systemctl_check.rc == 0 else 'No' }}",
|
|
"Cups-browsed service exists": "{{ 'Yes' if (systemctl_check.rc == 0 and cups_browsed_exists is defined and cups_browsed_exists.rc == 0) else 'No' }}",
|
|
"Cups-browsed service stopped and disabled": "{{ 'Stopped and Disabled' if (systemctl_check.rc == 0 and cups_browsed_exists is defined and cups_browsed_exists.rc == 0) else 'Not applicable' }}"
|
|
} |