Ansible: Loops and Conditionals – Get `ansible_os_family` and `ansible_pkg_mgr` with setup

We can get facts (ansible_os_family, ansible_pkg_mgr) with Ad-Hoc command of setup module and filter.

  • ansible_os_family:

      $ ansible all -m setup -a 'filter=ansible_os_family'
      ra.local | SUCCESS => {
          "ansible_facts": {
              "ansible_os_family": "Debian"
          },
          "changed": false
      }
    
  • ansible_pkg_mgr:

      $ ansible all -m setup -a 'filter=ansible_pkg_mgr'
      debian.local | SUCCESS => {
          "ansible_facts": {
              "ansible_pkg_mgr": "apt"
          },
          "changed": false
      }
    

if you want to reproduce, please indicate the source:
Ansible: Loops and Conditionals – Get `ansible_os_family` and `ansible_pkg_mgr` with setup - CodeDay