Ansible variables
Revision as of 11:29, 14 September 2016 by Freephile (talk | contribs) (added Category:DevOps using HotCat)
Facts
Assuming a hostname of wiki.example.net is defined in your 'hosts' inventory; using ansible wiki.example.net -m setup
you get a lot of information about the host (see https://docs.ansible.com/ansible/playbooks_variables.html#information-discovered-from-systems-facts).
wiki.example.net | SUCCESS => {
"ansible_facts": {
"ansible_all_ipv4_addresses": [
"159.203.181.27",
"10.10.0.7"
],
"ansible_all_ipv6_addresses": [
"fe80::b036:4ff:fe79:8688"
],
"ansible_architecture": "x86_64",
"ansible_bios_date": "04/25/2016",
"ansible_bios_version": "20160425",
"ansible_cmdline": {
"BOOT_IMAGE": "/boot/vmlinuz-4.4.0-36-generic",
"clocksource": "kvm-clock",
"console": "tty1",
"net.ifnames": "0",
"notsc": true,
"ro": true,
"root": "LABEL=DOROOT"
},
"ansible_date_time": {
"date": "2016-09-14",
"day": "14",
"epoch": "1473870269",
"hour": "16",
"iso8601": "2016-09-14T16:24:29Z",
"iso8601_basic": "20160914T162429394888",
"iso8601_basic_short": "20160914T162429",
"iso8601_micro": "2016-09-14T16:24:29.395036Z",
"minute": "24",
"month": "09",
"second": "29",
"time": "16:24:29",
"tz": "UTC",
"tz_offset": "+0000",
"weekday": "Wednesday",
"weekday_number": "3",
"weeknumber": "37",
"year": "2016"
},
"ansible_default_ipv4": {
"address": "159.203.181.27",
"alias": "eth0",
"broadcast": "159.203.191.255",
"gateway": "159.203.176.1",
"interface": "eth0",
"macaddress": "b2:36:04:79:86:88",
"mtu": 1500,
"netmask": "255.255.240.0",
"network": "159.203.176.0",
"type": "ether"
},
"ansible_default_ipv6": {},
"ansible_devices": {
"vda": {
"holders": [],
"host": "SCSI storage controller: Red Hat, Inc Virtio block device",
"model": null,
"partitions": {
"vda1": {
"holders": [],
"sectors": "41938911",
"sectorsize": 512,
"size": "20.00 GB",
"start": "4096"
},
"vda15": {
"holders": [],
"sectors": "2048",
"sectorsize": 512,
"size": "1.00 MB",
"start": "2048"
}
},
"removable": "0",
"rotational": "1",
"sas_address": null,
"sas_device_handle": null,
"scheduler_mode": "",
"sectors": "41943040",
"sectorsize": "512",
"size": "20.00 GB",
"support_discard": "0",
"vendor": "0x1af4"
}
},
"ansible_distribution": "Ubuntu",
"ansible_distribution_major_version": "14",
"ansible_distribution_release": "trusty",
"ansible_distribution_version": "14.04",
"ansible_dns": {
"nameservers": [
"8.8.8.8",
"8.8.4.4"
]
},
"ansible_domain": "example.net",
"ansible_env": {
"HOME": "/home/greg",
"LANG": "en_US.UTF-8",
"LOGNAME": "greg",
"MAIL": "/var/mail/greg",
"PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games",
"PWD": "/home/greg",
"SHELL": "/bin/bash",
"SHLVL": "1",
"SSH_CLIENT": "104.236.31.19 34747 22",
"SSH_CONNECTION": "104.236.31.19 34747 159.203.181.27 22",
"SSH_TTY": "/dev/pts/0",
"TERM": "xterm",
"USER": "greg",
"XDG_RUNTIME_DIR": "/run/user/1000",
"XDG_SESSION_ID": "7",
"_": "/bin/sh"
},
"ansible_eth0": {
"active": true,
"device": "eth0",
"features": {
"busy_poll": "on [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 [fixed]",
"netns_local": "off [fixed]",
"ntuple_filters": "off [fixed]",
"receive_hashing": "off [fixed]",
"rx_all": "off [fixed]",
"rx_checksumming": "on [fixed]",
"rx_fcs": "off [fixed]",
"rx_vlan_filter": "on [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_segmentation": "off [fixed]",
"tx_gso_robust": "on [fixed]",
"tx_ipip_segmentation": "off [fixed]",
"tx_lockless": "off [fixed]",
"tx_nocache_copy": "off",
"tx_scatter_gather": "on",
"tx_scatter_gather_fraglist": "off [fixed]",
"tx_sit_segmentation": "off [fixed]",
"tx_tcp6_segmentation": "on",
"tx_tcp_ecn_segmentation": "on",
"tx_tcp_segmentation": "on",
"tx_udp_tnl_segmentation": "off [fixed]",
"tx_vlan_offload": "off [fixed]",
"tx_vlan_stag_hw_insert": "off [fixed]",
"udp_fragmentation_offload": "on",
"vlan_challenged": "off [fixed]"
},
"ipv4": {
"address": "159.203.181.27",
"broadcast": "159.203.191.255",
"netmask": "255.255.240.0",
"network": "159.203.176.0"
},
"ipv4_secondaries": [
{
"address": "10.10.0.7",
"broadcast": "global",
"netmask": "255.255.0.0",
"network": "10.10.0.0"
}
],
"ipv6": [
{
"address": "fe80::b036:4ff:fe79:8688",
"prefix": "64",
"scope": "link"
}
],
"macaddress": "b2:36:04:79:86:88",
"mtu": 1500,
"pciid": "virtio0",
"promisc": false,
"type": "ether"
},
"ansible_eth1": {
"active": false,
"device": "eth1",
"features": {
"busy_poll": "on [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 [fixed]",
"netns_local": "off [fixed]",
"ntuple_filters": "off [fixed]",
"receive_hashing": "off [fixed]",
"rx_all": "off [fixed]",
"rx_checksumming": "on [fixed]",
"rx_fcs": "off [fixed]",
"rx_vlan_filter": "on [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_segmentation": "off [fixed]",
"tx_gso_robust": "on [fixed]",
"tx_ipip_segmentation": "off [fixed]",
"tx_lockless": "off [fixed]",
"tx_nocache_copy": "off",
"tx_scatter_gather": "on",
"tx_scatter_gather_fraglist": "off [fixed]",
"tx_sit_segmentation": "off [fixed]",
"tx_tcp6_segmentation": "on",
"tx_tcp_ecn_segmentation": "on",
"tx_tcp_segmentation": "on",
"tx_udp_tnl_segmentation": "off [fixed]",
"tx_vlan_offload": "off [fixed]",
"tx_vlan_stag_hw_insert": "off [fixed]",
"udp_fragmentation_offload": "on",
"vlan_challenged": "off [fixed]"
},
"macaddress": "6e:2d:ca:e7:63:01",
"mtu": 1500,
"pciid": "virtio1",
"promisc": false,
"type": "ether"
},
"ansible_fips": false,
"ansible_form_factor": "Other",
"ansible_fqdn": "wiki.example.net",
"ansible_gather_subset": [
"hardware",
"network",
"virtual"
],
"ansible_hostname": "wiki",
"ansible_interfaces": [
"lo",
"eth1",
"eth0"
],
"ansible_kernel": "4.4.0-36-generic",
"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_segmentation": "off [fixed]",
"tx_gso_robust": "off [fixed]",
"tx_ipip_segmentation": "off [fixed]",
"tx_lockless": "on [fixed]",
"tx_nocache_copy": "off [fixed]",
"tx_scatter_gather": "on [fixed]",
"tx_scatter_gather_fraglist": "on [fixed]",
"tx_sit_segmentation": "off [fixed]",
"tx_tcp6_segmentation": "on",
"tx_tcp_ecn_segmentation": "on",
"tx_tcp_segmentation": "on",
"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]"
},
"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,
"type": "loopback"
},
"ansible_lsb": {
"codename": "trusty",
"description": "Ubuntu 14.04.5 LTS",
"id": "Ubuntu",
"major_release": "14",
"release": "14.04"
},
"ansible_machine": "x86_64",
"ansible_machine_id": "9829945b0098be2d46ee2ed457c5ba5b",
"ansible_memfree_mb": 85,
"ansible_memory_mb": {
"nocache": {
"free": 300,
"used": 188
},
"real": {
"free": 85,
"total": 488,
"used": 403
},
"swap": {
"cached": 0,
"free": 4080,
"total": 4095,
"used": 15
}
},
"ansible_memtotal_mb": 488,
"ansible_mounts": [
{
"device": "/dev/vda1",
"fstype": "ext4",
"mount": "/",
"options": "rw,noatime,errors=remount-ro",
"size_available": 12450996224,
"size_total": 21002821632,
"uuid": ""
}
],
"ansible_nodename": "wiki.example.net",
"ansible_os_family": "Debian",
"ansible_pkg_mgr": "apt",
"ansible_processor": [
"GenuineIntel",
"Intel(R) Xeon(R) CPU E5-2650L v3 @ 1.80GHz"
],
"ansible_processor_cores": 1,
"ansible_processor_count": 1,
"ansible_processor_threads_per_core": 1,
"ansible_processor_vcpus": 1,
"ansible_product_name": "Droplet",
"ansible_product_serial": "NA",
"ansible_product_uuid": "NA",
"ansible_product_version": "20160415",
"ansible_python": {
"executable": "/usr/bin/python",
"has_sslcontext": false,
"type": "CPython",
"version": {
"major": 2,
"micro": 6,
"minor": 7,
"releaselevel": "final",
"serial": 0
},
"version_info": [
2,
7,
6,
"final",
0
]
},
"ansible_python_version": "2.7.6",
"ansible_selinux": false,
"ansible_service_mgr": "upstart",
"ansible_ssh_host_key_dsa_public": "AAAAB3NzaC1kc3MAAACBAM82Sv9Tgk1erJ+NVMu1oZjUpZYlyUWy4N+dGmMnVZtfr15F/k9MldhY+/4FK4NWgXmCRVbc+n02OATOu8XbR2pTkFgWjHdFrbnxLcHgN3wtxQMps7J9S/a5Bp3TImhBOqAy4nq7dh6VMHDw6iccbRo8ksN2XAFZY9FV/EsXpv1FAAAAFQD9vgzVAOsfdETzVCe19gOWCa/wCQAAAIAlnJrTPdsVHZ+PffWhSNFzIDBmO5c//MB375HYQqp48F24Op/Ta/b+VZ2orVC4C6tlNsNkaBjyjJllRAvjiD5TzfxHvNNuZE8MZX+qL6YB9+nRkjo1GqB0hBr1sDpxYRhf9JWDNoe/cwCs4Yz+Fop4fxJg+oCBxIhseVmelY1GhwAAAIBTYAKC2wtc8yRdyz9JHhcYXCX2WhR3NmxJJwjpNuaByFZpCZo/HyhV5kLmDjqJpxgaNaLFeHsV3UqWh0YJ1POpLKF4gMwPJHtAb+IUQGkHtYTj4XK0A+H0SEdIhOQbifys1ebhjjRiAJSmUaXoC2cVDPp2/NgjPjjwDGTMf+BACg==",
"ansible_ssh_host_key_ecdsa_public": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIqfraeEm0iklxooH+GBzERAQpgnvDVBMzfMWvAvx2IZg9XyiXfzhEi8MG8RlEPZYJXguNSQJUdpZ3mX7T7x7N8=",
"ansible_ssh_host_key_ed25519_public": "AAAAC3NzaC1lZDI1NTE5AAAAIPAn0/uCbpHRn7QIuQgRwzDw5QBnn3c+muuEMx+7hDAB",
"ansible_ssh_host_key_rsa_public": "AAAAB3NzaC1yc2EAAAADAQABAAABAQC85k1S2EFoMAfBDa011Q4bVe0QB0hwwIsdLyM1AzHoIxVt3bL+eNknDj37mKNbeNSf7A6M9/WMziFH+SO/Sql8n7sccwT3jAQVi7Rj8HZPPrJZLGxpZ9tX7SNif7tWaduvogFkc+6XfY6dW6skUvb+IYeJ6dka4WkN7VxKjVFocOu++lJ/ZKNDTW5mIQcJ3135t4kOdA1nEBAdLylutxyHfYTuaevwOADHpYlx+IsJgwhNnngfaUryR/NLoqaCcOJgEtQlOqy4RZtbGUL7Osz7R0Jdo6zatoDkS+pBA0g4BmIWlDdYZy8Vddi/DlLDvPCElZhu80mJl9A0XXHU0Kx9",
"ansible_swapfree_mb": 4080,
"ansible_swaptotal_mb": 4095,
"ansible_system": "Linux",
"ansible_system_capabilities": [
""
],
"ansible_system_capabilities_enforced": "True",
"ansible_system_vendor": "DigitalOcean",
"ansible_uptime_seconds": 410291,
"ansible_user_dir": "/home/greg",
"ansible_user_gecos": "Administrator account",
"ansible_user_gid": 1000,
"ansible_user_id": "greg",
"ansible_user_shell": "/bin/bash",
"ansible_user_uid": 1000,
"ansible_userspace_architecture": "x86_64",
"ansible_userspace_bits": "64",
"ansible_virtualization_role": "host",
"ansible_virtualization_type": "kvm",
"module_setup": true
},
"changed": false
}