獲取 ansible os 家族和 ansible pkg mgr 與設定
我們可以通過設定模組和過濾器的 Ad-Hoc 命令獲取事實(ansible_os_family
,ansible_pkg_mgr
)。
-
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 }