facts 指的是 ansible_facts 变量,ansible 中使用 setup 模块来获取,包含系统的大部分基础硬件信息,
命令:ansible all -m setup -i inventory/hosts
·150.1.7.152 | SUCCESS => { "ansible_facts": { "ansible_all_ipv4_addresses": [ "150.1.7.152" ], "ansible_all_ipv6_addresses": [ "fe80::20c:29ff:fe4b:5024" ], "ansible_apparmor": { "status": "disabled" }, "ansible_architecture": "x86_64", "ansible_bios_date": "12/12/2018", "ansible_bios_version": "6.00", "ansible_cmdline": { "BOOT_IMAGE": "/vmlinuz-3.10.0-957.el7.x86_64", "crashkernel": "auto", "quiet": true, "rd.lvm.lv": "rhel/swap", "rhgb": true, "ro": true, "root": "/dev/mapper/rhel-root", "transparent_hugepage": "never" }, "ansible_date_time": { "date": "2020-07-03", "day": "03", "epoch": "1593784553", "hour": "21", "iso8601": "2020-07-03T13:55:53Z", "iso8601_basic": "20200703T215553632899", "iso8601_basic_short": "20200703T215553", "iso8601_micro": "2020-07-03T13:55:53.632993Z", "minute": "55", "month": "07", "second": "53", "time": "21:55:53", "tz": "CST", "tz_offset": "+0800", "weekday": "Friday", "weekday_number": "5", "weeknumber": "26", "year": "2020" }, "ansible_default_ipv4": { "address": "150.1.7.152", "alias": "ens192", "broadcast": "150.1.7.255", "gateway": "150.1.7.1", "interface": "ens192", "macaddress": "00:0c:29:4b:50:24", "mtu": 1500, "netmask": "255.255.255.0", "network": "150.1.7.0", "type": "ether" }, "ansible_default_ipv6": {}, "ansible_device_links": { "ids": { "dm-0": [ "dm-name-rhel-root", "dm-uuid-LVM-r43Bwd4ffGyqj3EzIfxzXhLMSIcsX0PjIP1HenjwzN2yiq5pSdMlWNd7D6oP0gok" ], "dm-1": [ "dm-name-rhel-swap", "dm-uuid-LVM-r43Bwd4ffGyqj3EzIfxzXhLMSIcsX0PjY144OLeeZrN5yoGxeevgaxzCqtJ9iyBf" ], "sda2": [ "lvm-pv-uuid-i2SdaF-UGnC-icaZ-9jG7-vm0a-OGHC-fNT8NR" ], "sr0": [ "ata-VMware_Virtual_SATA_CDRW_Drive_00000000000000000001" ] }, "labels": {}, "masters": { "sda2": [ "dm-0", "dm-1" ] }, "uuids": { "dm-0": [ "8c3149e0-0b45-4e6f-a7e0-5872901625f0" ], "dm-1": [ "b6afd8ef-9de8-4fee-8e70-bb587d027a2d" ], "sda1": [ "45640e31-e7b1-406d-a403-c06e877ecf75" ], "sdb1": [ "6b9840b6-8c89-48ee-b296-75fe6d17b66d" ] } }, "ansible_devices": { "dm-0": { "holders": [], "host": "", "links": { "ids": [ "dm-name-rhel-root", "dm-uuid-LVM-r43Bwd4ffGyqj3EzIfxzXhLMSIcsX0PjIP1HenjwzN2yiq5pSdMlWNd7D6oP0gok" ], "labels": [], "masters": [], "uuids": [ "8c3149e0-0b45-4e6f-a7e0-5872901625f0" ] }, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "31457280", "sectorsize": "512", "size": "15.00 GB", "support_discard": "0", "vendor": null, "virtual": 1 }, "dm-1": { "holders": [], "host": "", "links": { "ids": [ "dm-name-rhel-swap", "dm-uuid-LVM-r43Bwd4ffGyqj3EzIfxzXhLMSIcsX0PjY144OLeeZrN5yoGxeevgaxzCqtJ9iyBf" ], "labels": [], "masters": [], "uuids": [ "b6afd8ef-9de8-4fee-8e70-bb587d027a2d" ] }, "model": null, "partitions": {}, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "", "sectors": "8380416", "sectorsize": "512", "size": "4.00 GB", "support_discard": "0", "vendor": null, "virtual": 1 }, "sda": { "holders": [], "host": "Serial Attached SCSI controller: VMware PVSCSI SCSI Controller (rev 02)", "links": { "ids": [], "labels": [], "masters": [], "uuids": [] }, "model": "Virtual disk", "partitions": { "sda1": { "holders": [], "links": { "ids": [], "labels": [], "masters": [], "uuids": [ "45640e31-e7b1-406d-a403-c06e877ecf75" ] }, "sectors": "2097152", "sectorsize": 512, "size": "1.00 GB", "start": "2048", "uuid": "45640e31-e7b1-406d-a403-c06e877ecf75" }, "sda2": { "holders": [ "rhel-root", "rhel-swap" ], "links": { "ids": [ "lvm-pv-uuid-i2SdaF-UGnC-icaZ-9jG7-vm0a-OGHC-fNT8NR" ], "labels": [], "masters": [ "dm-0", "dm-1" ], "uuids": [] }, "sectors": "39843840", "sectorsize": 512, "size": "19.00 GB", "start": "2099200", "uuid": null } }, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "deadline", "sectors": "41943040", "sectorsize": "512", "size": "20.00 GB", "support_discard": "0", "vendor": "VMware", "virtual": 1 }, "sdb": { "holders": [], "host": "Serial Attached SCSI controller: VMware PVSCSI SCSI Controller (rev 02)", "links": { "ids": [], "labels": [], "masters": [], "uuids": [] }, "model": "Virtual disk", "partitions": { "sdb1": { "holders": [], "links": { "ids": [], "labels": [], "masters": [], "uuids": [ "6b9840b6-8c89-48ee-b296-75fe6d17b66d" ] }, "sectors": "209711104", "sectorsize": 512, "size": "100.00 GB", "start": "2048", "uuid": "6b9840b6-8c89-48ee-b296-75fe6d17b66d" } }, "removable": "0", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "deadline", "sectors": "209715200", "sectorsize": "512", "size": "100.00 GB", "support_discard": "512", "vendor": "VMware", "virtual": 1 }, "sr0": { "holders": [], "host": "SATA controller: VMware SATA AHCI controller", "links": { "ids": [ "ata-VMware_Virtual_SATA_CDRW_Drive_00000000000000000001" ], "labels": [], "masters": [], "uuids": [] }, "model": "VMware SATA CD00", "partitions": {}, "removable": "1", "rotational": "1", "sas_address": null, "sas_device_handle": null, "scheduler_mode": "deadline", "sectors": "2097151", "sectorsize": "512", "size": "1024.00 MB", "support_discard": "0", "vendor": "NECVMWar", "virtual": 1 } }, "ansible_distribution": "RedHat", "ansible_distribution_file_parsed": true, "ansible_distribution_file_path": "/etc/redhat-release", "ansible_distribution_file_search_string": "Red Hat", "ansible_distribution_file_variety": "RedHat", "ansible_distribution_major_version": "7", "ansible_distribution_release": "Maipo", "ansible_distribution_version": "7.6", "ansible_dns": {}, "ansible_domain": "", "ansible_effective_group_id": 0, "ansible_effective_user_id": 0, "ansible_ens192": { "active": true, "device": "ens192", "features": { "busy_poll": "off [fixed]", "fcoe_mtu": "off [fixed]", "generic_receive_offload": "on", "generic_segmentation_offload": "on", "highdma": "on", "hw_tc_offload": "off [fixed]", "l2_fwd_offload": "off [fixed]", "large_receive_offload": "on", "loopback": "off [fixed]", "netns_local": "off [fixed]", "ntuple_filters": "off [fixed]", "receive_hashing": "off [fixed]", "rx_all": "off [fixed]", "rx_checksumming": "on", "rx_fcs": "off [fixed]", "rx_gro_hw": "off [fixed]", "rx_udp_tunnel_port_offload": "off [fixed]", "rx_vlan_filter": "on [fixed]", "rx_vlan_offload": "on", "rx_vlan_stag_filter": "off [fixed]", "rx_vlan_stag_hw_parse": "off [fixed]", "scatter_gather": "on", "tcp_segmentation_offload": "on", "tx_checksum_fcoe_crc": "off [fixed]", "tx_checksum_ip_generic": "on", "tx_checksum_ipv4": "off [fixed]", "tx_checksum_ipv6": "off [fixed]", "tx_checksum_sctp": "off [fixed]", "tx_checksumming": "on", "tx_fcoe_segmentation": "off [fixed]", "tx_gre_csum_segmentation": "off [fixed]", "tx_gre_segmentation": "off [fixed]", "tx_gso_partial": "off [fixed]", "tx_gso_robust": "off [fixed]", "tx_ipip_segmentation": "off [fixed]", "tx_lockless": "off [fixed]", "tx_nocache_copy": "off", "tx_scatter_gather": "on", "tx_scatter_gather_fraglist": "off [fixed]", "tx_sctp_segmentation": "off [fixed]", "tx_sit_segmentation": "off [fixed]", "tx_tcp6_segmentation": "on", "tx_tcp_ecn_segmentation": "off [fixed]", "tx_tcp_mangleid_segmentation": "off", "tx_tcp_segmentation": "on", "tx_udp_tnl_csum_segmentation": "off [fixed]", "tx_udp_tnl_segmentation": "off [fixed]", "tx_vlan_offload": "on", "tx_vlan_stag_hw_insert": "off [fixed]", "udp_fragmentation_offload": "off [fixed]", "vlan_challenged": "off [fixed]" }, "hw_timestamp_filters": [], "ipv4": { "address": "150.1.7.152", "broadcast": "150.1.7.255", "netmask": "255.255.255.0", "network": "150.1.7.0" }, "ipv6": [ { "address": "fe80::20c:29ff:fe4b:5024", "prefix": "64", "scope": "link" } ], "macaddress": "00:0c:29:4b:50:24", "module": "vmxnet3", "mtu": 1500, "pciid": "0000:0b:00.0", "promisc": false, "speed": 10000, "timestamping": [ "rx_software", "software" ], "type": "ether" }, "ansible_env": { "HOME": "/root", "LANG": "en_US.UTF-8", "LESSOPEN": "||/usr/bin/lesspipe.sh %s", "LOGNAME": "root", "LS_COLORS": "rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:", "MAIL": "/var/mail/root", "PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin", "PWD": "/root", "SHELL": "/bin/bash", "SHLVL": "2", "SSH_CLIENT": "150.1.7.151 34306 22", "SSH_CONNECTION": "150.1.7.151 34306 150.1.7.152 22", "SSH_TTY": "/dev/pts/1", "TERM": "linux", "USER": "root", "XDG_RUNTIME_DIR": "/run/user/0", "XDG_SESSION_ID": "28", "_": "/usr/bin/python" }, "ansible_fibre_channel_wwn": [], "ansible_fips": false, "ansible_form_factor": "Other", "ansible_fqdn": "test-193", "ansible_hostname": "test-152", "ansible_hostnqn": "", "ansible_interfaces": [ "lo", "ens192" ], "ansible_is_chroot": false, "ansible_iscsi_iqn": "", "ansible_kernel": "3.10.0-957.el7.x86_64", "ansible_kernel_version": "#1 SMP Thu Oct 4 20:48:51 UTC 2018", "ansible_lo": { "active": true, "device": "lo", "features": { "busy_poll": "off [fixed]", "fcoe_mtu": "off [fixed]", "generic_receive_offload": "on", "generic_segmentation_offload": "on", "highdma": "on [fixed]", "hw_tc_offload": "off [fixed]", "l2_fwd_offload": "off [fixed]", "large_receive_offload": "off [fixed]", "loopback": "on [fixed]", "netns_local": "on [fixed]", "ntuple_filters": "off [fixed]", "receive_hashing": "off [fixed]", "rx_all": "off [fixed]", "rx_checksumming": "on [fixed]", "rx_fcs": "off [fixed]", "rx_gro_hw": "off [fixed]", "rx_udp_tunnel_port_offload": "off [fixed]", "rx_vlan_filter": "off [fixed]", "rx_vlan_offload": "off [fixed]", "rx_vlan_stag_filter": "off [fixed]", "rx_vlan_stag_hw_parse": "off [fixed]", "scatter_gather": "on", "tcp_segmentation_offload": "on", "tx_checksum_fcoe_crc": "off [fixed]", "tx_checksum_ip_generic": "on [fixed]", "tx_checksum_ipv4": "off [fixed]", "tx_checksum_ipv6": "off [fixed]", "tx_checksum_sctp": "on [fixed]", "tx_checksumming": "on", "tx_fcoe_segmentation": "off [fixed]", "tx_gre_csum_segmentation": "off [fixed]", "tx_gre_segmentation": "off [fixed]", "tx_gso_partial": "off [fixed]", "tx_gso_robust": "off [fixed]", "tx_ipip_segmentation": "off [fixed]", "tx_lockless": "on [fixed]", "tx_nocache_copy": "off [fixed]", "tx_scatter_gather": "on [fixed]", "tx_scatter_gather_fraglist": "on [fixed]", "tx_sctp_segmentation": "on", "tx_sit_segmentation": "off [fixed]", "tx_tcp6_segmentation": "on", "tx_tcp_ecn_segmentation": "on", "tx_tcp_mangleid_segmentation": "on", "tx_tcp_segmentation": "on", "tx_udp_tnl_csum_segmentation": "off [fixed]", "tx_udp_tnl_segmentation": "off [fixed]", "tx_vlan_offload": "off [fixed]", "tx_vlan_stag_hw_insert": "off [fixed]", "udp_fragmentation_offload": "on", "vlan_challenged": "on [fixed]" }, "hw_timestamp_filters": [], "ipv4": { "address": "127.0.0.1", "broadcast": "host", "netmask": "255.0.0.0", "network": "127.0.0.0" }, "ipv6": [ { "address": "::1", "prefix": "128", "scope": "host" } ], "mtu": 65536, "promisc": false, "timestamping": [ "rx_software", "software" ], "type": "loopback" }, "ansible_local": {}, "ansible_lsb": {}, "ansible_lvm": { "lvs": { "root": { "size_g": "15.00", "vg": "rhel" }, "swap": { "size_g": "4.00", "vg": "rhel" } }, "pvs": { "/dev/sda2": { "free_g": "0", "size_g": "19.00", "vg": "rhel" } }, "vgs": { "rhel": { "free_g": "0", "num_lvs": "2", "num_pvs": "1", "size_g": "19.00" } } }, "ansible_machine": "x86_64", "ansible_machine_id": "d071270f65614047877026cb27c829d1", "ansible_memfree_mb": 2999, "ansible_memory_mb": { "nocache": { "free": 3568, "used": 221 }, "real": { "free": 2999, "total": 3789, "used": 790 }, "swap": { "cached": 0, "free": 4091, "total": 4091, "used": 0 } }, "ansible_memtotal_mb": 3789, "ansible_mounts": [ { "block_available": 222484, "block_size": 4096, "block_total": 259584, "block_used": 37100, "device": "/dev/sda1", "fstype": "xfs", "inode_available": 523963, "inode_total": 524288, "inode_used": 325, "mount": "/boot", "options": "rw,relatime,attr2,inode64,noquota", "size_available": 911294464, "size_total": 1063256064, "uuid": "45640e31-e7b1-406d-a403-c06e877ecf75" }, { "block_available": 5, "block_size": 4096, "block_total": 26201089, "block_used": 26201084, "device": "/dev/sdb1", "fstype": "xfs", "inode_available": 119, "inode_total": 40552, "inode_used": 40433, "mount": "/u01", "options": "rw,relatime,attr2,inode64,noquota", "size_available": 20480, "size_total": 107319660544, "uuid": "6b9840b6-8c89-48ee-b296-75fe6d17b66d" }, { "block_available": 3614364, "block_size": 4096, "block_total": 3929600, "block_used": 315236, "device": "/dev/mapper/rhel-root", "fstype": "xfs", "inode_available": 7827530, "inode_total": 7864320, "inode_used": 36790, "mount": "/", "options": "rw,relatime,attr2,inode64,noquota", "size_available": 14804434944, "size_total": 16095641600, "uuid": "8c3149e0-0b45-4e6f-a7e0-5872901625f0" } ], "ansible_nodename": "test-152", "ansible_os_family": "RedHat", "ansible_pkg_mgr": "yum", "ansible_proc_cmdline": { "BOOT_IMAGE": "/vmlinuz-3.10.0-957.el7.x86_64", "crashkernel": "auto", "quiet": true, "rd.lvm.lv": [ "rhel/root", "rhel/swap" ], "rhgb": true, "ro": true, "root": "/dev/mapper/rhel-root", "transparent_hugepage": "never" }, "ansible_processor": [ "0", "GenuineIntel", "Intel(R) Xeon(R) Gold 6238 CPU @ 2.10GHz" ], "ansible_processor_cores": 1, "ansible_processor_count": 1, "ansible_processor_threads_per_core": 1, "ansible_processor_vcpus": 1, "ansible_product_name": "VMware Virtual Platform", "ansible_product_serial": "VMware-56 4d 5f c7 59 57 18 95-28 46 ee fc 38 4b 50 24", "ansible_product_uuid": "C75F4D56-5759-9518-2846-EEFC384B5024", "ansible_product_version": "None", "ansible_python": { "executable": "/usr/bin/python", "has_sslcontext": true, "type": "CPython", "version": { "major": 2, "micro": 5, "minor": 7, "releaselevel": "final", "serial": 0 }, "version_info": [ 2, 7, 5, "final", 0 ] }, "ansible_python_version": "2.7.5", "ansible_real_group_id": 0, "ansible_real_user_id": 0, "ansible_selinux": { "status": "disabled" }, "ansible_selinux_python_present": true, "ansible_service_mgr": "systemd", "ansible_ssh_host_key_ecdsa_public": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBDO3uzZ0+3FlrZ1xjMLFUHFNOjxMnFFPFhZpn48yfWPwMTd30SneErx8NzdU2ORr6ggl7z4sqo0UFlcX9bz7b6I=", "ansible_ssh_host_key_ed25519_public": "AAAAC3NzaC1lZDI1NTE5AAAAIEXlTfip/6L6H7dPi9wBaLHneUUf5es0p2GgbPAj7RXq", "ansible_ssh_host_key_rsa_public": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDNlaDiEGvRQjJdUddcFgceoKtyZGWLxcRNy8x5UuRSzC1v9+NF12kezJpvTXkm9yNfOEVrg94+aEVx/aEqrTUiDqO3D6nsQyQ4kPOUHf/ljxbbw4rwt2L7neHfiJGgRH8OyuEmwTpM/iGhX1plOMW4G114RY8AhnDnaufGfZ6dQmm3pX4k2kw9b396k0Qr5DkO5ws49JcgLcmfZb2ONrE8kwfQzHuD5aQDxwTITQT9d7h1z/ZOYeaVjY3A8AxYy61NwWGEAkZbv5z0uW/RnTHmehEaP9x29N1dKPmK1QpSddFG3icPCucpZpy+jDSpU1MWFlWrWPlK+y3yt1NHA0Kt", "ansible_swapfree_mb": 4091, "ansible_swaptotal_mb": 4091, "ansible_system": "Linux", "ansible_system_capabilities": [ "cap_chown", "cap_dac_override", "cap_dac_read_search", "cap_fowner", "cap_fsetid", "cap_kill", "cap_setgid", "cap_setuid", "cap_setpcap", "cap_linux_immutable", "cap_net_bind_service", "cap_net_broadcast", "cap_net_admin", "cap_net_raw", "cap_ipc_lock", "cap_ipc_owner", "cap_sys_module", "cap_sys_rawio", "cap_sys_chroot", "cap_sys_ptrace", "cap_sys_pacct", "cap_sys_admin", "cap_sys_boot", "cap_sys_nice", "cap_sys_resource", "cap_sys_time", "cap_sys_tty_config", "cap_mknod", "cap_lease", "cap_audit_write", "cap_audit_control", "cap_setfcap", "cap_mac_override", "cap_mac_admin", "cap_syslog", "35", "36+ep" ], "ansible_system_capabilities_enforced": "True", "ansible_system_vendor": "VMware, Inc.", "ansible_uptime_seconds": 8898, "ansible_user_dir": "/root", "ansible_user_gecos": "root", "ansible_user_gid": 0, "ansible_user_id": "root", "ansible_user_shell": "/bin/bash", "ansible_user_uid": 0, "ansible_userspace_architecture": "x86_64", "ansible_userspace_bits": "64", "ansible_virtualization_role": "guest", "ansible_virtualization_type": "VMware", "discovered_interpreter_python": "/usr/bin/python", "gather_subset": [ "all" ], "module_setup": true }, "changed": false }