# Copyright 2022 Dell Inc. or its subsidiaries. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. --- - name: Gathering service facts service_facts: - name: Disable bluetooth services block: - name: Disabling bluetooth service service: name: bluetooth enabled: no state: stopped when: - "'bluetooth.service' in ansible_facts.services" - ansible_facts.services['bluetooth.service'].status in service_status - name: Disabling bluez service service: name: dbus-org.bluez.service enabled: no state: stopped failed_when: false when: - "'dbus-org.bluez.service' in ansible_facts.services" - ansible_facts.services['dbus-org.bluez.service'].status in service_status - name: Disabling blueman service systemd: name: blueman-mechanism.service state: stopped enabled: no when: - "'blueman-mechanism.service' in ansible_facts.services" - ansible_facts.services['blueman-mechanism.service'].status in service_status when: "'bluetooth' in disable_services" - name: Disabling telnet service service: name: telnet.socket enabled: no state: stopped when: - "'telnet' in disable_services" - "'telnet@.service' in ansible_facts.services" - ansible_facts.services['telnet@.service'].status in service_status - name: Disabling lpd service service: name: cups-lpd.socket enabled: no state: stopped when: - "'lpd' in disable_services" - "'cups-lpd@.service' in ansible_facts.services" - ansible_facts.services['cups-lpd@.service'].status in service_status - name: Disabling rlogin service service: name: rlogin.socket enabled: no state: stopped when: - "'rlogin' in disable_services" - "'rlogin.socket' in ansible_facts.services" - ansible_facts.services['rlogin.socket'].status in service_status - name: Disabling rexec service service: name: rexec.socket enabled: no state: stopped changed_when: false when: - "'rexec' in disable_services" - "'rexec.socket' in ansible_facts.services" - ansible_facts.services['rexec.socket'].status in service_status