--- - name: Install base tools required by builtin metrics collection hosts: all:!localhost:!hp.truenas.home:!ali2v.truenas.home become: true gather_facts: true vars: _builtin_playbook: true _builtin_id: install_base_tools _collect_metrics: false base_packages_debian: - coreutils - util-linux - gawk - grep - python3 - iproute2 - procps optional_packages_debian: - lvm2 - lm-sensors - zfsutils-linux optional_packages_rpi_debian: - libraspberrypi-bin tasks: - name: Detect Raspberry Pi (Debian) ansible.builtin.set_fact: is_raspberry_pi: >- {{ (ansible_distribution | default('')) in ['Raspbian'] or ((ansible_lsb | default({})).id | default('')) in ['Raspbian'] or ('raspberry' in (ansible_machine | default('') | lower)) }} when: ansible_os_family == "Debian" - name: Install base packages (Debian/Ubuntu) ansible.builtin.apt: name: "{{ base_packages_debian }}" state: present update_cache: true when: ansible_os_family == "Debian" register: apt_base - name: Install optional packages (Debian/Ubuntu) ansible.builtin.apt: name: "{{ optional_packages_debian }}" state: present update_cache: false when: ansible_os_family == "Debian" register: apt_optional ignore_errors: true - name: Install Raspberry Pi optional packages (Debian/Ubuntu) ansible.builtin.apt: name: "{{ optional_packages_rpi_debian }}" state: present update_cache: false when: - ansible_os_family == "Debian" - is_raspberry_pi | default(false) register: apt_optional_rpi ignore_errors: true - name: Install base packages (RedHat) ansible.builtin.yum: name: - coreutils - util-linux - gawk - grep - python3 - iproute - procps-ng state: present when: ansible_os_family == "RedHat" register: yum_base - name: Install optional packages (RedHat) ansible.builtin.yum: name: - lvm2 - lm_sensors state: present when: ansible_os_family == "RedHat" register: yum_optional ignore_errors: true - name: Install packages (Alpine) ansible.builtin.apk: name: - coreutils - util-linux - gawk - grep - python3 - iproute2 - procps - lvm2 - lm-sensors state: present update_cache: true when: ansible_os_family == "Alpine" register: apk_base - name: Install base packages (FreeBSD) ansible.builtin.package: name: - gawk - python3 state: present when: ansible_os_family == "FreeBSD" register: pkg_base - name: Output installation summary ansible.builtin.debug: msg: "BASE_TOOLS_INSTALL_RESULT host={{ inventory_hostname }} os_family={{ ansible_os_family }}"