知识点:ping模块,用于确认和对象机器之间是否能够ping通,正常情况会返回pong
知识点:setup模块,用于收集对象机器的基本设定信息。
ping使用实例
[root@host31 ansible]# ansible host32 -m ping
host32 | SUCCESS => {
"changed": false,
"ping": "pong"
}
[root@host31 ansible]#
setup使用实例
不用option的情况会输出所有相关的对象机器的facts
[root@host31 ~]# ansible host32 -m setup
host32 | SUCCESS => {
"ansible_facts": {
"ansible_all_ipv4_addresses": [
"192.168.122.1",
"172.16.96.1",
"172.16.96.0",
"192.168.32.32"
],
"ansible_all_ipv6_addresses": [
"fe80::20:56ff:fe8a:59b",
"fe80::20c:29ff:febe:1cff"
],
"ansible_architecture": "x86_64",
"ansible_bios_date": "07/02/2015",
"ansible_bios_version": "6.00",
"ansible_cmdline": {
"BOOT_IMAGE": "/vmlinuz-3.10.0-327.el7.x86_64",
"LANG": "en_US.UTF-8",
"quiet": true,
"rd.lvm.lv": "centos/swap",
"rhgb": true,
"ro": true,
"root": "/dev/mapper/centos-root"
},
"ansible_date_time": {
"date": "2016-07-30",
"day": "30",
"epoch": "1469884080",
"hour": "09",
"iso8601": "2016-07-30T13:08:00Z",
"iso8601_basic": "20160730T090800352254",
"iso8601_basic_short": "20160730T090800",
"iso8601_micro": "2016-07-30T13:08:00.352338Z",
"minute": "08",
"month": "07",
"second": "00",
"time": "09:08:00",
"tz": "EDT",
"tz_offset": "-0400",
"weekday": "Saturday",
"weekday_number": "6",
"weeknumber": "30",
"year": "2016"
},
"ansible_default_ipv4": {
"address": "192.168.32.32",
"alias": "eno16777736",
"broadcast": "192.168.32.255",
"gateway": "192.168.32.2",
"interface": "eno16777736",
"macaddress": "00:0c:29:be:1c:ff",
"mtu": 1500,
"netmask": "255.255.255.0",
"network": "192.168.32.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": "19945472",
"sectorsize": 512,
"size": "9.51 GB",
"start": "1026048"
}
},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode