Linux基础命令 Ansible事实变量常见fact

发布时间:2021-12-28 00:00:00

短主机名:ansible_facts['hostname']
完全限定的域名:ansible_facts['fqdn']
主机IPV4地址:ansible_facts['default_ipv4']['address']
所有网络接口列表:ansible_facts['interfaces']
/dev/vdal磁盘分区大小:ansible_facts['devices']['vda']['partitions']['vda1']['size']
DNS服务器列表:ansible_facts['dns']['nameservers']
当前运行内核版本:ansible_facts['kernal']

事实的查看方式有很多,我这里举例一个,也是最方便的,ansible localhost -m setup


<<