I have this ansible playbook:
---
- name: Install Suricata 7 from source on Debian
  hosts: all
  become: yes

  vars:
    suricata_version: "7.0.6"  # Specify the Suricata version to install

  pre_tasks:
    - name: Ensure sudo is installed
      apt:
        name: sudo
        state: present

  tasks:
    - name: Update apt cache
      ansible.builtin.apt:
        update_cache: yes

    - name: Install required build dependencies
      ansible.builtin.apt:
        name:
          - build-essential
          - libpcre2-dev
          - libpcap-dev
          - libyaml-dev
          - zlib1g-dev
          - libcap-ng-dev
          - libmagic-dev
          - libjansson-dev
          - libnss3-dev
          - libgeoip-dev
          - liblua5.3-dev
          - libhiredis-dev
          - libmaxminddb-dev
          - rustc
          - cargo
          - libnetfilter-queue-dev
          - libnetfilter-log-dev
          - libnfnetlink-dev
          - wget
          - tar
          - libevent-dev
          - libmnl-dev
        state: present

    - name: Download Suricata source code
      ansible.builtin.get_url:
        url: "https://www.openinfosecfoundation.org/download/suricata-{{ suricata_version }}.tar.gz"
        dest: "/tmp/suricata-{{ suricata_version }}.tar.gz"

    - name: Extract Suricata source code
      ansible.builtin.unarchive:
        src: "/tmp/suricata-{{ suricata_version }}.tar.gz"
        dest: "/tmp/"
        remote_src: yes

    - name: Compile and install Suricata
      ansible.builtin.shell: |
        cd /tmp/suricata-{{ suricata_version }}
        ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-nfqueue --enable-geoip
        make
        make install-full
        ldconfig

    - name: Create Suricata log directory
      ansible.builtin.file:
        path: /var/log/suricata
        state: directory
        owner: root
        group: root
        mode: '0755'

    - name: Copy Suricata YAML config file
      ansible.builtin.copy:
        src: ../suricata/suricata.yaml
        dest: /etc/suricata/suricata.yaml
        owner: root
        group: root
        mode: '0644'

    - name: Copy Suricata systemd service file
      ansible.builtin.copy:
        src: ../suricata/suricatavel.service
        dest: /etc/systemd/system/suricata.service
        owner: root
        group: root
        mode: '0644'

    - name: Reload systemd daemon to recognize Suricata service
      ansible.builtin.systemd:
        daemon_reload: yes

    - name: Enable and start Suricata service
      ansible.builtin.systemd:
        name: suricata
        enabled: yes
        state: started

    - name: Verify Suricata installation
      command: suricata --build-info
      register: suricata_version_info

    - name: Display Suricata version
      ansible.builtin.debug:
        msg: "Suricata version installed: {{ suricata_version_info.stdout }}"

I want to make sure that sudo is installed, before gathering facts, so I'm using pre_tasks.

However, when I run this playbook with:
ansible-playbook -i '192.168.1.105:22', /var/www/html/suricatavel/releases/20240913191129/support/ansible/debian.yml --extra-vars 'ansible_ssh_pass=filldeputA90' -vvvÇ

I still see the gathering facts run at first, and thus failing with "sudo: not found"