zoukankan      html  css  js  c++  java
  • Ansible facts

    facts组件是Ansible用于采集被管理机器设备信息的一个功能。可以使用setup模块查机器的所有facts信息,可以使用filter来查看指定信息。整个facts信息被包装在一个json格式的数据结构中,ansible_facts是最上层的值

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    [root@LVS_Master playbook]# ansible 192.168.170.129 -m setup
    192.168.170.129 | SUCCESS => {
        "ansible_facts": {
            "ansible_all_ipv4_addresses": [
                "192.168.170.129",
                "192.168.170.188"
            ],
            "ansible_all_ipv6_addresses": [
                "fe80::20c:29ff:fea0:6cd4"
            ],
            "ansible_architecture": "x86_64",
            "ansible_bios_date": "07/02/2015",
            "ansible_bios_version": "6.00",
            "ansible_cmdline": {
                "KEYBOARDTYPE": "pc",
                "KEYTABLE": "us",
                "LANG": "zh_CN.UTF-8",
                "quiet": true,
                "rd_NO_DM": true,
                "rd_NO_LUKS": true,
                "rd_NO_LVM": true,
                "rd_NO_MD": true,
                "rhgb": true,
                "ro": true,
                "root": "UUID=b42623ce-7b8d-411c-bc1b-26ba53cfc4d8"
            },
            "ansible_date_time": {
                "date": "2016-11-22",
                "day": "22",
                "epoch": "1479793846",
                "hour": "13",
                "iso8601": "2016-11-22T05:50:46Z",
                "iso8601_basic": "20161122T135046459819",
                "iso8601_basic_short": "20161122T135046",
                "iso8601_micro": "2016-11-22T05:50:46.460213Z",
                "minute": "50",
                "month": "11",
                "second": "46",
                "time": "13:50:46",
                "tz": "CST",
                "tz_offset": "+0800",
                "weekday": "星期二",
                "weekday_number": "2",
                "weeknumber": "47",
                "year": "2016"
            },
            "ansible_default_ipv4": {
                "address": "192.168.170.129",
                "alias": "eth0",
                "broadcast": "192.168.170.255",
                "gateway": "192.168.170.2",
                "interface": "eth0",
                "macaddress": "00:0c:29:a0:6c:d4",
                "mtu": 1500,
                "netmask": "255.255.255.0",
                "network": "192.168.170.0",
                "type": "ether"
            },
    --------此处省略N行-------------------

    所有数据格式都是JSON格式,facts还支持查看指定信息,如下所示:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    [root@LVS_Master playbook]# ansible 192.168.170.129 -m setup -a 'filter=ansible_all_ipv4_addresses'
    192.168.170.129 | SUCCESS => {
        "ansible_facts": {
            "ansible_all_ipv4_addresses": [
                "192.168.170.129",
                "192.168.170.188"
            ]
        },
        "changed": false
    }
  • 相关阅读:
    REDUCING THE SEARCH SPACE FOR HYPERPARAMETER OPTIMIZATION USING GROUP SPARSITY阅读笔记
    缓存穿透、缓存击穿、缓存雪崩区别和解决方案
    Jenkins中构建时提示:Couldn't find any revision to build. Verify the repository and branch config
    Docker中使用Dockerfile定制化jar启动时:at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264)
    Docker中部署mysql后SpringBoot连接时提示表不存在(修改表名忽略大小写)
    js使用y-seal实现印章功能
    手写js原生方法总结(简版)
    P5666
    CF653G
    P4649
  • 原文地址:https://www.cnblogs.com/davidshen/p/10593349.html
Copyright © 2011-2022 走看看