torlee 发表于 2018-7-30 11:21:20

自动化运维工具Ansible之Playbooks变量的使用

# ansible webservers -m setup  
192.168.1.65 | success >> {
  
    "ansible_facts": {
  
      "ansible_all_ipv4_addresses": [
  
            "192.168.1.65"
  
      ],
  
      "ansible_all_ipv6_addresses": [
  
            "fe80::250:56ff:fe93:a885"
  
      ],
  
      "ansible_architecture": "x86_64",
  
      "ansible_bios_date": "01/07/2011",
  
      "ansible_bios_version": "6.00",
  
      "ansible_cmdline": {
  
            "KEYBOARDTYPE": "pc",
  
            "KEYTABLE": "us",
  
            "LANG": "en_US.UTF-8",
  
            "SYSFONT": "latarcyrheb-sun16",
  
            "crashkernel": "129M@0M",
  
            "quiet": true,
  
            "rd_NO_DM": true,
  
            "rd_NO_LUKS": true,
  
            "rd_NO_LVM": true,
  
            "rd_NO_MD": true,
  
            "rhgb": true,
  
            "ro": true,
  
            "root": "UUID=c3e6eda7-d67d-4787-8f9f-6534941f11fd"
  
      },
  
      "ansible_date_time": {
  
            "date": "2015-07-30",
  
            "day": "30",
  
            "epoch": "1438241766",
  
            "hour": "15",
  
            "iso8601": "2015-07-30T07:36:06Z",
  
            "iso8601_micro": "2015-07-30T07:36:06.373646Z",
  
            "minute": "36",
  
            "month": "07",
  
            "second": "06",
  
            "time": "15:36:06",
  
            "tz": "CST",
  
            "tz_offset": "+0800",
  
            "weekday": "Thursday",
  
            "year": "2015"
  
      },
  
      "ansible_default_ipv4": {
  
            "address": "192.168.1.65",
  
            "alias": "eth1",
  
            "gateway": "192.168.1.254",
  
            "interface": "eth1",
  
            "macaddress": "00:50:56:93:a8:85",
  
            "mtu": 1500,
  
            "netmask": "255.255.255.0",
  
            "network": "192.168.1.0",
  
            "type": "ether"
  
      },
  
       #省略若干行内容
  
      "ansible_eth1": {
  
            "active": true,
  
            "device": "eth1",
  
            "ipv4": {
  
                "address": "192.168.1.65",
  
                "netmask": "255.255.255.0",
  
                "network": "192.168.1.0"
  
            },
  
            "ipv6": [
  
                {
  
                  "address": "fe80::250:56ff:fe93:a885",
  
                  "prefix": "64",
  
                  "scope": "link"
  
                }
  
            ],
  
            "macaddress": "00:50:56:93:a8:85",
  
            "module": "vmxnet3",
  
            "mtu": 1500,
  
            "promisc": false,
  
            "type": "ether"
  
      },
  
      "ansible_fips": false,
  
      "ansible_form_factor": "Other",
  
      "ansible_fqdn": "db2",
  
      "ansible_hostname": "db2",
  
      "ansible_interfaces": [
  
            "lo",
  
            "eth1"
  
      ],
  

  
      ......省略若干行内容......
页: [1]
查看完整版本: 自动化运维工具Ansible之Playbooks变量的使用