--- - hosts: "{{ hosts_target }}" become: false gather_facts: true vars_files: - /root/.secret/.ansible/vars_creds.yml tasks: - name: Upgrage system type of Debian block: - name: Run "apt update" and "apt upgrade" ansible.builtin.apt: upgrade: yes update_cache: yes - name: Run "apt autoremove" ansible.builtin.apt: autoremove: yes - name: Run "apt-get clean" ansible.builtin.apt: clean: yes when: ansible_facts['distribution'] == "Debian"