- name: Gather and print relevant system facts hosts: all gather_facts: false # disable default full fact gathering tasks: - name: Gather only selected facts ansible.builtin.setup: filter: - ansible_hostname - ansible_distribution - ansible_distribution_version - ansible_kernel - ansible_architecture - ansible_default_ipv4 - name: Show relevant facts ansible.builtin.debug: msg: - "Hostname: {{ ansible_facts['hostname'] }}" - "OS: {{ ansible_facts['distribution'] }} {{ ansible_facts['distribution_version'] }}" - "Kernel: {{ ansible_facts['kernel'] }}" - "Architecture: {{ ansible_facts['architecture'] }}" - "IP Address: {{ ansible_facts['default_ipv4']['address'] }}"