---
- name: Disable wireless interfaces
  environment:
    PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  block:
    - name: Install network-manager
      become: true
      ansible.builtin.apt:
        name: network-manager
        state: present
        install_recommends: false
      when: ansible_os_family == "Debian"

    - name: Get WiFi state
      ansible.builtin.command: nmcli -t radio
      register: wifi_state_pre
      changed_when: wifi_state_pre.rc != 0
      failed_when: wifi_state_pre.rc != 0

    - name: Turn off wireless interfaces
      become: true
      ansible.builtin.command: nmcli radio all off
      register: nmcli_radio
      changed_when: nmcli_radio.rc != 0
      failed_when: nmcli_radio.rc != 0
      tags:
        - wireless
        - CCE-83501-7
        - CIS-UBUNTU2004-3.1.2
...
