ansible 192.168.80.20 -m setup
192.168.80.20 | SUCCESS => { "ansible_facts": { "ansible_all_ipv4_addresses": [ "192.168.80.20" ], "ansible_all_ipv6_addresses": [ "fe80::20c:29ff:fec9:1e72" ], "ansible_architecture": "x86_64", "ansible_bios_date": "07/31/2013", "ansible_bios_version": "6.00", "ansible_cmdline": { "KEYBOARDTYPE": "pc", "KEYTABLE": "us", "LANG": "zh_CN.UTF-8", "quiet": true, "rd_LVM_LV": "VolGroup/lv_root", "rd_NO_DM": true, "rd_NO_LUKS": true, "rd_NO_MD": true, "rhgb": true, "ro": true, "root": "/dev/mapper/VolGroup-lv_root" }, "ansible_date_time": { "date": "2016-05-12", "day": "12", "epoch": "1463003126", "hour": "05", "iso8601": "2016-05-11T21:45:26Z", "iso8601_basic": "20160512T054526759137", "iso8601_basic_short": "20160512T054526", "iso8601_micro": "2016-05-11T21:45:26.759236Z", "minute": "45", "month": "05", "second": "26", "time": "05:45:26", "tz": "CST", "tz_offset": "+0800", "weekday": "星期四", "weekday_number": "4", "weeknumber": "19", "year": "2016" }, "ansible_default_ipv4": { "address": "192.168.80.20", "alias": "eth0", "broadcast": "192.168.80.255", "gateway": "192.168.80.2", "interface": "eth0", "macaddress": "00:0c:29:c9:1e:72", "mtu": 1500, "netmask": "255.255.255.0", "network": "192.168.80.0", "type": "ether" }, "ansible_default_ipv6": {}, "ansible_devices": { "sda": { "holders": [], "host": "SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)", "model": "VMware Virtual S", "partitions": { "sda1": { "sectors": "1024000", "sectorsize": 512, "size": "500.00 MB", "start": "2048" }, "sda2": { "sectors": "40916992", "sectorsize": 512, "size": "19.51 GB", "start": "1026048" } }, "removable": "0", "rotational": "1", "scheduler_mode": "cfq", "sectors": "41943040", "sectorsize": "512", "size": "20.00 GB", "support_discard": "0", "vendor": "VMware," }, "sr0": { "holders": [], "host": "IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)", "model": "VMware IDE CDR10", "partitions": {}, "removable": "1", "rotational": "1", "scheduler_mode": "cfq", "sectors": "2097151", "sectorsize": "512", "size": "1024.00 MB", "support_discard": "0", "vendor": "NECVMWar" } }, "ansible_distribution": "CentOS", "ansible_distribution_major_version": "6", "ansible_distribution_release": "Final", "ansible_distribution_version": "6.5", "ansible_dns": { "nameservers": [ "114.114.114.114" ] }, "ansible_domain": "localdomain", "ansible_env": { "CVS_RSH": "ssh", "G_BROKEN_FILENAMES": "1", "HOME": "/root", "LANG": "zh_CN.UTF-8", "LC_ALL": "zh_CN.UTF-8", "LC_MESSAGES": "zh_CN.UTF-8", "LESSOPEN": "|/usr/bin/lesspipe.sh %s", "LOGNAME": "root", "MAIL": "/var/mail/root", "PATH": "/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin", "PWD": "/root", "QTDIR": "/usr/lib64/qt-3.3", "QTINC": "/usr/lib64/qt-3.3/include", "QTLIB": "/usr/lib64/qt-3.3/lib", "SHELL": "/bin/bash", "SHLVL": "2", "SSH_ASKPASS": "/usr/libexec/openssh/gnome-ssh-askpass", "SSH_CLIENT": "192.168.80.10 54722 22", "SSH_CONNECTION": "192.168.80.10 54722 192.168.80.20 22", "SSH_TTY": "/dev/pts/0", "TERM": "xterm", "USER": "root", "_": "/usr/bin/python" }, "ansible_eth0": { "active": true, "device": "eth0", "ipv4": { "address": "192.168.80.20", "broadcast": "192.168.80.255", "netmask": "255.255.255.0", "network": "192.168.80.0" }, "ipv6": [ { "address": "fe80::20c:29ff:fec9:1e72", "prefix": "64", "scope": "link" } ], "macaddress": "00:0c:29:c9:1e:72", "module": "e1000", "mtu": 1500, "pciid": "0000:02:01.0", "promisc": false, "type": "ether" }, "ansible_fips": false, "ansible_form_factor": "Other", "ansible_fqdn": "localhost.localdomain", "ansible_hostname": "localhost", "ansible_interfaces": [ "lo", "pan0", "eth0" ], "ansible_kernel": "2.6.32-431.el6.x86_64", "ansible_lo": { "active": true, "device": "lo", "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": 16436, "promisc": false, "type": "loopback" }, "ansible_lsb": { "codename": "Final", "description": "CentOS release 6.5 (Final)", "id": "CentOS", "major_release": "6", "release": "6.5" }, "ansible_lvm": { "lvs": { "lv_root": { "size_g": "17.57", "vg": "VolGroup" }, "lv_swap": { "size_g": "1.94", "vg": "VolGroup" } }, "vgs": { "VolGroup": { "free_g": "0", "num_lvs": "2", "num_pvs": "1", "size_g": "19.51" } } }, "ansible_machine": "x86_64", "ansible_machine_id": "20f2093f8670b19b462abf220000000c", "ansible_memfree_mb": 157, "ansible_memory_mb": { "nocache": { "free": 845, "used": 143 }, "real": { "free": 157, "total": 988, "used": 831 }, "swap": { "cached": 0, "free": 1983, "total": 1983, "used": 0 } }, "ansible_memtotal_mb": 988, "ansible_mounts": [ { "device": "/dev/mapper/VolGroup-lv_root", "fstype": "ext4", "mount": "/", "options": "rw", "size_available": 13993938944, "size_total": 18569568256, "uuid": "f4379dd8-9633-4163-a5ae-10fc3bb438ce" }, { "device": "/dev/sda1", "fstype": "ext4", "mount": "/boot", "options": "rw", "size_available": 445827072, "size_total": 507744256, "uuid": "38aeb88b-9c2c-4741-b6d8-715ff36526e8" } ], "ansible_nodename": "localhost.localdomain", "ansible_os_family": "RedHat", "ansible_pan0": { "active": false, "device": "pan0", "id": "8000.000000000000", "interfaces": [], "macaddress": "5a:a3:d9:52:2c:97", "mtu": 1500, "promisc": false, "stp": false, "type": "bridge" }, "ansible_pkg_mgr": "yum", "ansible_processor": [ "GenuineIntel", "Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz" ], "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 17 d9 0d e6 ad 0e-a6 ec 51 79 00 c9 1e 72", "ansible_product_uuid": "564D17D9-0DE6-AD0E-A6EC-517900C91E72", "ansible_product_version": "None", "ansible_python_version": "2.6.6", "ansible_selinux": { "status": "disabled" }, "ansible_service_mgr": "upstart", "ansible_ssh_host_key_dsa_public": "AAAAB3NzaC1kc3MAAACBAIYyJsfzRGiNvWTPjeUarXuc3j2ikhtQ8cHRME1ogbiV3Jo3kfUOI1xi2tKWqUvqW65IocpfgHsKl72YOyCnbwM6IagL6QOkHHhV2cjzvcj0NT4EsWhaGEXroIMEkH51w362zYnnuU1IeEuBeLPJikeYqK2tlePMrU4vD8zd3CRdAAAAFQCqI4kOUDeqwpKXU8RkWwNbfCh70QAAAIAV7RiY1Uj3+fPJmBii2F2Y6IOlxBs7vN1fyqlBk0ZlyYwZgJFWVYl+iELTu00ka2fYYcBufz1sZ4JA7EKK1KUiDIaaZnM1QdHl0H4nSb3MJ6sYXhQ4363qSf3ma3ioTlRAI4066GnKfvwRN/jDCWWQ8dRJ0QcX/dVqh5S40h6mFgAAAIBpHoGSBAJMdw67znMLKv89PFbuOnB/cMrb5xD+fGXOnld3B6m8qyaEjXNJVIzZOtLBDHhSf6xvhay6R6C6XM825jTyCLacFFKGdHBqkb0IZzOcrhbcjmc2jBq3sB2n8k7834Jz9bPWSGTWsvo4boIZR+BkBPfQIuDX95JnCzw/1g==", "ansible_ssh_host_key_rsa_public": "AAAAB3NzaC1yc2EAAAABIwAAAQEAoJ8J4kpA2wRFvrKJur9k9bT5vYdgJDKH9gYcTAJu7ZWQyeYqMXFbZ+O4qimN5tP/Rb6KcE5DRaam5L+mhzOXMWLjzsNPNdTD2JTzuylVD1Ki2ayDhZUryaRSTh9O7N+wrH7tEpdJujf5jQTLaF4tBX+5mQwUVPg5A7HqXulvcuJK9AJO02tIDWarfyDyZBz5gYIpd4/HcuWXL1z/cmAH7bXoxAxGTZ+XgezjE+G5sUnK812EOeuUzfRjupUJGyAtS6mIZMTjnuDgNRi7a8lVpgfsG7E6ksZxJdlzgIjYpOLO2PAUBhlW0kqhVoXMcj4i7AfNahC7IPQdeNeC10qVOQ==", "ansible_swapfree_mb": 1983, "ansible_swaptotal_mb": 1983, "ansible_system": "Linux", "ansible_system_vendor": "VMware, Inc.", "ansible_uptime_seconds": 71942, "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", "module_setup": true }, "changed": false }
使用setup中的值
{{ansible_eth0.ipv4.address}}
字典用"."连接
列表用"_"连接
时间: 2024-10-10 17:06:36