Ansible - Facts (Remote System Env)

Card Puncher Data Processing

About

Facts are variable that contains environment information from the remote systems (ie current host (inventory_hostname))

  • ansible_facts contains any facts gathered or cached for the inventory_hostname Facts are normally gathered by the M(setup) module automatically in a play, but any module can return facts.
  • ansible_local contains any local facts gathered or cached for the inventory_hostname. The keys available depend on the custom facts created. See the M(setup) module for more details.

Management

Set

  • Built-in (Created by Ansible)

set_fact module

https://docs.ansible.com/ansible/latest/modules/set_fact_module.html

Local

Local placed in the remote system in a file - called local fact

  • directory given in the fact_path play keyword. Default to /etc/ansible/facts.d
  • files in this directory ending in .fact,
  • files format can be JSON, INI, or executable files returning JSON

Steps:

  • Create a fact file
;  lower case always
[general]
asdf=1 
bar=2
ansible <hostname> -m setup -a "filter=ansible_local"
"ansible_local": {
        "preferences": {
            "general": {
                "asdf" : "1",
                "bar"  : "2"
            }
        }
 }
{{ ansible_local['preferences']['general']['asdf'] }}

List

You can find a complete set under the ansible_facts variable.

To get a list:

- debug: var=ansible_facts
ansible -m setup hostname -i inventory.ini -u user

Disable

In a play

- hosts: whatever
  gather_facts: no

Conditional Task based on fact

with ansible_os_family:

    tasks:
        - yum: pkg=httpd state=present
           when: ansible_os_family == "RedHat"

All facts output

This is the output of the setup module for one host. See list

{
    "ansible_facts": {
        "ansible_all_ipv4_addresses": [
            "10.40.35.101"
        ], 
        "ansible_all_ipv6_addresses": [
            "fe80::20d:3aff:fe2b:f7b0"
        ], 
        "ansible_apparmor": {
            "status": "disabled"
        }, 
        "ansible_architecture": "x86_64", 
        "ansible_bios_date": "06/02/2017", 
        "ansible_bios_version": "090007", 
        "ansible_cmdline": {
            "BOOT_IMAGE": "/vmlinuz-3.10.0-693.17.1.el7.x86_64", 
            "LANG": "en_US.UTF-8", 
            "console": "ttyS0", 
            "earlyprintk": "ttyS0", 
            "ro": true, 
            "root": "UUID=ef39b601-3484-4f7c-81f0-3cb8b79eeda1", 
            "rootdelay": "300"
        }, 
        "ansible_date_time": {
            "date": "2018-11-07", 
            "day": "07", 
            "epoch": "1541605232", 
            "hour": "15", 
            "iso8601": "2018-11-07T15:40:32Z", 
            "iso8601_basic": "20181107T154032613887", 
            "iso8601_basic_short": "20181107T154032", 
            "iso8601_micro": "2018-11-07T15:40:32.614054Z", 
            "minute": "40", 
            "month": "11", 
            "second": "32", 
            "time": "15:40:32", 
            "tz": "UTC", 
            "tz_offset": "+0000", 
            "weekday": "Wednesday", 
            "weekday_number": "3", 
            "weeknumber": "45", 
            "year": "2018"
        }, 
        "ansible_default_ipv4": {
            "address": "10.40.35.101", 
            "alias": "eth0", 
            "broadcast": "10.40.35.127", 
            "gateway": "10.40.35.97", 
            "interface": "eth0", 
            "macaddress": "00:0d:3a:2b:f7:b0", 
            "mtu": 1500, 
            "netmask": "255.255.255.224", 
            "network": "10.40.35.96", 
            "type": "ether"
        }, 
        "ansible_default_ipv6": {}, 
        "ansible_device_links": {
            "ids": {
                "sda": [
                    "scsi-3600224809e154e05ebbe977a9dc27c61", 
                    "wwn-0x600224809e154e05ebbe977a9dc27c61"
                ], 
                "sda1": [
                    "scsi-3600224809e154e05ebbe977a9dc27c61-part1", 
                    "wwn-0x600224809e154e05ebbe977a9dc27c61-part1"
                ], 
                "sda2": [
                    "scsi-3600224809e154e05ebbe977a9dc27c61-part2", 
                    "wwn-0x600224809e154e05ebbe977a9dc27c61-part2"
                ], 
                "sdb": [
                    "scsi-36002248043b64d9676c71eced66438e3", 
                    "wwn-0x6002248043b64d9676c71eced66438e3"
                ], 
                "sdb1": [
                    "scsi-36002248043b64d9676c71eced66438e3-part1", 
                    "wwn-0x6002248043b64d9676c71eced66438e3-part1"
                ], 
                "sdc": [
                    "scsi-360022480b5aeac0972ce6d0faf48ffad", 
                    "wwn-0x60022480b5aeac0972ce6d0faf48ffad"
                ], 
                "sdc1": [
                    "scsi-360022480b5aeac0972ce6d0faf48ffad-part1", 
                    "wwn-0x60022480b5aeac0972ce6d0faf48ffad-part1"
                ]
            }, 
            "labels": {}, 
            "masters": {}, 
            "uuids": {
                "sda1": [
                    "58ff0739-95d1-4c47-a630-a4cd98cd4a0b"
                ], 
                "sda2": [
                    "ef39b601-3484-4f7c-81f0-3cb8b79eeda1"
                ], 
                "sdb1": [
                    "1382b5b5-8d66-4d0a-91e8-01413f04db8a"
                ], 
                "sdc1": [
                    "839b0d5b-1298-4cf7-be55-6b988d6e1688"
                ]
            }
        }, 
        "ansible_devices": {
            "fd0": {
                "holders": [], 
                "host": "", 
                "links": {
                    "ids": [], 
                    "labels": [], 
                    "masters": [], 
                    "uuids": []
                }, 
                "model": null, 
                "partitions": {}, 
                "removable": "1", 
                "rotational": "1", 
                "sas_address": null, 
                "sas_device_handle": null, 
                "scheduler_mode": "deadline", 
                "sectors": "8", 
                "sectorsize": "512", 
                "size": "4.00 KB", 
                "support_discard": "0", 
                "vendor": null, 
                "virtual": 1
            }, 
            "sda": {
                "holders": [], 
                "host": "", 
                "links": {
                    "ids": [
                        "scsi-3600224809e154e05ebbe977a9dc27c61", 
                        "wwn-0x600224809e154e05ebbe977a9dc27c61"
                    ], 
                    "labels": [], 
                    "masters": [], 
                    "uuids": []
                }, 
                "model": "Virtual Disk", 
                "partitions": {
                    "sda1": {
                        "holders": [], 
                        "links": {
                            "ids": [
                                "scsi-3600224809e154e05ebbe977a9dc27c61-part1", 
                                "wwn-0x600224809e154e05ebbe977a9dc27c61-part1"
                            ], 
                            "labels": [], 
                            "masters": [], 
                            "uuids": [
                                "58ff0739-95d1-4c47-a630-a4cd98cd4a0b"
                            ]
                        }, 
                        "sectors": "1024000", 
                        "sectorsize": 512, 
                        "size": "500.00 MB", 
                        "start": "2048", 
                        "uuid": "58ff0739-95d1-4c47-a630-a4cd98cd4a0b"
                    }, 
                    "sda2": {
                        "holders": [], 
                        "links": {
                            "ids": [
                                "scsi-3600224809e154e05ebbe977a9dc27c61-part2", 
                                "wwn-0x600224809e154e05ebbe977a9dc27c61-part2"
                            ], 
                            "labels": [], 
                            "masters": [], 
                            "uuids": [
                                "ef39b601-3484-4f7c-81f0-3cb8b79eeda1"
                            ]
                        }, 
                        "sectors": "267409375", 
                        "sectorsize": 512, 
                        "size": "127.51 GB", 
                        "start": "1026048", 
                        "uuid": "ef39b601-3484-4f7c-81f0-3cb8b79eeda1"
                    }
                }, 
                "removable": "0", 
                "rotational": "1", 
                "sas_address": null, 
                "sas_device_handle": null, 
                "scheduler_mode": "deadline", 
                "sectors": "268435456", 
                "sectorsize": "512", 
                "size": "128.00 GB", 
                "support_discard": "2097152", 
                "vendor": "Msft", 
                "virtual": 1, 
                "wwn": "0x600224809e154e05ebbe977a9dc27c61"
            }, 
            "sdb": {
                "holders": [], 
                "host": "", 
                "links": {
                    "ids": [
                        "scsi-36002248043b64d9676c71eced66438e3", 
                        "wwn-0x6002248043b64d9676c71eced66438e3"
                    ], 
                    "labels": [], 
                    "masters": [], 
                    "uuids": []
                }, 
                "model": "Virtual Disk", 
                "partitions": {
                    "sdb1": {
                        "holders": [], 
                        "links": {
                            "ids": [
                                "scsi-36002248043b64d9676c71eced66438e3-part1", 
                                "wwn-0x6002248043b64d9676c71eced66438e3-part1"
                            ], 
                            "labels": [], 
                            "masters": [], 
                            "uuids": [
                                "1382b5b5-8d66-4d0a-91e8-01413f04db8a"
                            ]
                        }, 
                        "sectors": "268433280", 
                        "sectorsize": 512, 
                        "size": "128.00 GB", 
                        "start": "128", 
                        "uuid": "1382b5b5-8d66-4d0a-91e8-01413f04db8a"
                    }
                }, 
                "removable": "0", 
                "rotational": "1", 
                "sas_address": null, 
                "sas_device_handle": null, 
                "scheduler_mode": "deadline", 
                "sectors": "268435456", 
                "sectorsize": "512", 
                "size": "128.00 GB", 
                "support_discard": "2097152", 
                "vendor": "Msft", 
                "virtual": 1, 
                "wwn": "0x6002248043b64d9676c71eced66438e3"
            }, 
            "sdc": {
                "holders": [], 
                "host": "", 
                "links": {
                    "ids": [
                        "scsi-360022480b5aeac0972ce6d0faf48ffad", 
                        "wwn-0x60022480b5aeac0972ce6d0faf48ffad"
                    ], 
                    "labels": [], 
                    "masters": [], 
                    "uuids": []
                }, 
                "model": "Virtual Disk", 
                "partitions": {
                    "sdc1": {
                        "holders": [], 
                        "links": {
                            "ids": [
                                "scsi-360022480b5aeac0972ce6d0faf48ffad-part1", 
                                "wwn-0x60022480b5aeac0972ce6d0faf48ffad-part1"
                            ], 
                            "labels": [], 
                            "masters": [], 
                            "uuids": [
                                "839b0d5b-1298-4cf7-be55-6b988d6e1688"
                            ]
                        }, 
                        "sectors": "268433408", 
                        "sectorsize": 512, 
                        "size": "128.00 GB", 
                        "start": "2048", 
                        "uuid": "839b0d5b-1298-4cf7-be55-6b988d6e1688"
                    }
                }, 
                "removable": "0", 
                "rotational": "1", 
                "sas_address": null, 
                "sas_device_handle": null, 
                "scheduler_mode": "deadline", 
                "sectors": "268435456", 
                "sectorsize": "512", 
                "size": "128.00 GB", 
                "support_discard": "2097152", 
                "vendor": "Msft", 
                "virtual": 1, 
                "wwn": "0x60022480b5aeac0972ce6d0faf48ffad"
            }
        }, 
        "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.4", 
        "ansible_dns": {
            "nameservers": [
                "10.40.34.245", 
                "10.40.34.244"
            ], 
            "search": [
                "reddog.microsoft.com"
            ]
        }, 
        "ansible_domain": "domainName", 
        "ansible_effective_group_id": 1000, 
        "ansible_effective_user_id": 1000, 
        "ansible_env": {
            "HOME": "/home/username", 
            "LANG": "en_US.UTF-8", 
            "LESSOPEN": "||/usr/bin/lesspipe.sh %s", 
            "LOGNAME": "username", 
            "MAIL": "/var/mail/username", 
            "PATH": "/usr/local/bin:/usr/bin", 
            "PWD": "/home/username", 
            "SELINUX_LEVEL_REQUESTED": "", 
            "SELINUX_ROLE_REQUESTED": "", 
            "SELINUX_USE_CURRENT_RANGE": "", 
            "SHELL": "/bin/bash", 
            "SHLVL": "2", 
            "SSH_CLIENT": "172.16.1.24 55139 22", 
            "SSH_CONNECTION": "172.16.1.24 55139 10.40.35.101 22", 
            "USER": "username", 
            "XDG_RUNTIME_DIR": "/run/user/1000", 
            "XDG_SESSION_ID": "264382", 
            "_": "/usr/bin/python"
        }, 
        "ansible_eth0": {
            "active": true, 
            "device": "eth0", 
            "features": {
                "busy_poll": "off [fixed]", 
                "fcoe_mtu": "off [fixed]", 
                "generic_receive_offload": "on", 
                "generic_segmentation_offload": "on", 
                "highdma": "off [fixed]", 
                "hw_tc_offload": "off [fixed]", 
                "l2_fwd_offload": "off [fixed]", 
                "large_receive_offload": "off [fixed]", 
                "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_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", 
                "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_mpls_segmentation": "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 [fixed]", 
                "tx_vlan_stag_hw_insert": "off [fixed]", 
                "udp_fragmentation_offload": "off [fixed]", 
                "vlan_challenged": "off [fixed]"
            }, 
            "hw_timestamp_filters": [], 
            "ipv4": {
                "address": "10.40.35.101", 
                "broadcast": "10.40.35.127", 
                "netmask": "255.255.255.224", 
                "network": "10.40.35.96"
            }, 
            "ipv6": [
                {
                    "address": "fe80::20d:3aff:fe2b:f7b0", 
                    "prefix": "64", 
                    "scope": "link"
                }
            ], 
            "macaddress": "00:0d:3a:2b:f7:b0", 
            "module": "hv_netvsc", 
            "mtu": 1500, 
            "pciid": "000d3a2b-f7b0-000d-3a2b-f7b0000d3a2b", 
            "promisc": false, 
            "speed": 40000, 
            "timestamping": [
                "tx_software", 
                "rx_software", 
                "software"
            ], 
            "type": "ether"
        }, 
        "ansible_eth1": {
            "active": true, 
            "device": "eth1", 
            "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": "off", 
                "netns_local": "off [fixed]", 
                "ntuple_filters": "off", 
                "receive_hashing": "on", 
                "rx_all": "off [fixed]", 
                "rx_checksumming": "on", 
                "rx_fcs": "off", 
                "rx_vlan_filter": "on [fixed]", 
                "rx_vlan_offload": "on", 
                "rx_vlan_stag_filter": "on [fixed]", 
                "rx_vlan_stag_hw_parse": "on", 
                "scatter_gather": "on", 
                "tcp_segmentation_offload": "on", 
                "tx_checksum_fcoe_crc": "off [fixed]", 
                "tx_checksum_ip_generic": "off [fixed]", 
                "tx_checksum_ipv4": "on", 
                "tx_checksum_ipv6": "on", 
                "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_mpls_segmentation": "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": [], 
            "macaddress": "00:0d:3a:2b:f7:b0", 
            "module": "mlx4_core", 
            "mtu": 1500, 
            "pciid": "0001:00:02.0", 
            "promisc": false, 
            "speed": 40000, 
            "timestamping": [
                "tx_software", 
                "rx_software", 
                "software"
            ], 
            "type": "ether"
        }, 
        "ansible_fips": false, 
        "ansible_form_factor": "Desktop", 
        "ansible_fqdn": "su20etl201a.adds.ns.nl", 
        "ansible_hostname": "su20etl201a", 
        "ansible_interfaces": [
            "lo", 
            "eth1", 
            "eth0"
        ], 
        "ansible_is_chroot": true, 
        "ansible_iscsi_iqn": "", 
        "ansible_kernel": "3.10.0-693.17.1.el7.x86_64", 
        "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_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_mpls_segmentation": "off [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_machine": "x86_64", 
        "ansible_machine_id": "6ca77495007b44b5b7983fa8f0e34d11", 
        "ansible_memfree_mb": 9788, 
        "ansible_memory_mb": {
            "nocache": {
                "free": 23411, 
                "used": 41003
            }, 
            "real": {
                "free": 9788, 
                "total": 64414, 
                "used": 54626
            }, 
            "swap": {
                "cached": 5, 
                "free": 848, 
                "total": 2047, 
                "used": 1199
            }
        }, 
        "ansible_memtotal_mb": 64414, 
        "ansible_mounts": [
            {
                "block_available": 27397305, 
                "block_size": 4096, 
                "block_total": 33422138, 
                "block_used": 6024833, 
                "device": "/dev/sda2", 
                "fstype": "xfs", 
                "inode_available": 66787994, 
                "inode_total": 66852336, 
                "inode_used": 64342, 
                "mount": "/", 
                "options": "rw,seclabel,relatime,attr2,inode64,noquota", 
                "size_available": 112219361280, 
                "size_total": 136897077248, 
                "uuid": "ef39b601-3484-4f7c-81f0-3cb8b79eeda1"
            }, 
            {
                "block_available": 94130, 
                "block_size": 4096, 
                "block_total": 127145, 
                "block_used": 33015, 
                "device": "/dev/sda1", 
                "fstype": "xfs", 
                "inode_available": 255664, 
                "inode_total": 256000, 
                "inode_used": 336, 
                "mount": "/boot", 
                "options": "rw,seclabel,relatime,attr2,inode64,noquota", 
                "size_available": 385556480, 
                "size_total": 520785920, 
                "uuid": "58ff0739-95d1-4c47-a630-a4cd98cd4a0b"
            }, 
            {
                "block_available": 10013706, 
                "block_size": 4096, 
                "block_total": 32994817, 
                "block_used": 22981111, 
                "device": "/dev/sdc1", 
                "fstype": "ext4", 
                "inode_available": 7915919, 
                "inode_total": 8388608, 
                "inode_used": 472689, 
                "mount": "/opt/infa", 
                "options": "rw,seclabel,relatime,data=ordered", 
                "size_available": 41016139776, 
                "size_total": 135146770432, 
                "uuid": "839b0d5b-1298-4cf7-be55-6b988d6e1688"
            }, 
            {
                "block_available": 30773341, 
                "block_size": 4096, 
                "block_total": 32994801, 
                "block_used": 2221460, 
                "device": "/dev/sdb1", 
                "fstype": "ext4", 
                "inode_available": 8388595, 
                "inode_total": 8388608, 
                "inode_used": 13, 
                "mount": "/mnt/resource", 
                "options": "rw,seclabel,relatime,data=ordered", 
                "size_available": 126047604736, 
                "size_total": 135146704896, 
                "uuid": "1382b5b5-8d66-4d0a-91e8-01413f04db8a"
            }
        ], 
        "ansible_nodename": "hostname", 
        "ansible_os_family": "RedHat", 
        "ansible_pkg_mgr": "yum", 
        "ansible_processor": [
            "0", 
            "GenuineIntel", 
            "Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz", 
            "1", 
            "GenuineIntel", 
            "Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz", 
            "2", 
            "GenuineIntel", 
            "Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz", 
            "3", 
            "GenuineIntel", 
            "Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz", 
            "4", 
            "GenuineIntel", 
            "Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz", 
            "5", 
            "GenuineIntel", 
            "Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz", 
            "6", 
            "GenuineIntel", 
            "Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz", 
            "7", 
            "GenuineIntel", 
            "Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz", 
            "8", 
            "GenuineIntel", 
            "Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz", 
            "9", 
            "GenuineIntel", 
            "Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz", 
            "10", 
            "GenuineIntel", 
            "Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz", 
            "11", 
            "GenuineIntel", 
            "Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz", 
            "12", 
            "GenuineIntel", 
            "Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz", 
            "13", 
            "GenuineIntel", 
            "Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz", 
            "14", 
            "GenuineIntel", 
            "Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz", 
            "15", 
            "GenuineIntel", 
            "Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz"
        ], 
        "ansible_processor_cores": 8, 
        "ansible_processor_count": 1, 
        "ansible_processor_threads_per_core": 2, 
        "ansible_processor_vcpus": 16, 
        "ansible_product_name": "Virtual Machine", 
        "ansible_product_serial": "NA", 
        "ansible_product_uuid": "10D6B0F3-76F2-014D-910F-EE26E8D96974", 
        "ansible_product_version": "7.0", 
        "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": 1000, 
        "ansible_real_user_id": 1000, 
        "ansible_selinux": {
            "config_mode": "enforcing", 
            "mode": "enforcing", 
            "policyvers": 28, 
            "status": "enabled", 
            "type": "targeted"
        }, 
        "ansible_selinux_python_present": true, 
        "ansible_service_mgr": "systemd", 
        "ansible_ssh_host_key_ecdsa_public": "L6+Y68vhis7fMsa0FRBk/uMCQ7R9xIAC0o71C/bxLHnjVZ+f0IZm6yKrL04AulNA/XSc4WTg1/8LwPRuTOsgy0=", 
        "ansible_ssh_host_key_ed25519_public": "AAAAC3NzaC1NTE5AAAAICog1yIkGzx+zg0HxWIZ74HZW22YYbcCICfcvfYuBWxa", 
        "ansible_ssh_host_key_rsa_public": "AAAAB3NzaC1yc2EAA2ntaX0gmo4c8fC1Zq8UIxLKc2CHhvw0lZ+4ooAKGSTBMFqbbZXObgjxX5MBJ", 
        "ansible_swapfree_mb": 848, 
        "ansible_swaptotal_mb": 2047, 
        "ansible_system": "Linux", 
        "ansible_system_capabilities": [
            ""
        ], 
        "ansible_system_capabilities_enforced": "True", 
        "ansible_system_vendor": "Microsoft Corporation", 
        "ansible_uptime_seconds": 11423155, 
        "ansible_user_dir": "/home/username", 
        "ansible_user_gecos": "", 
        "ansible_user_gid": 1000, 
        "ansible_user_id": "username", 
        "ansible_user_shell": "/bin/bash", 
        "ansible_user_uid": 1000, 
        "ansible_userspace_architecture": "x86_64", 
        "ansible_userspace_bits": "64", 
        "ansible_virtualization_role": "guest", 
        "ansible_virtualization_type": "VirtualPC", 
        "gather_subset": [
            "all"
        ], 
        "module_setup": true
    }, 
    "changed": false
}

Documentation / Reference





Discover More
Card Puncher Data Processing
Ansible - Host (system)

A host may have zero or more than one group (ie webserver and a dbserver). In a inventory file as playbook variable. Example Variable that are defined on the group level can be defined:...
Card Puncher Data Processing
Ansible - Playbook

Playbook is the language of Ansible. Ansible modules are the function Playbooks are declarative instruction written in Yaml that run module functions A playbook is a list of play. Playbooks are:...
Card Puncher Data Processing
Playbook Variable

This article is variable inside a playbook, task, ... Single value Boolean Block of text Order...



Share this page:
Follow us:
Task Runner