-
-
Save ogomaemmanuel/8cd69ccd51c0f25e097ea2a5e3cbf74e to your computer and use it in GitHub Desktop.
ansible variables group_names and group_names from hostvars have different content when printed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [foo] | |
| localhost ansible_host=localhost ansible_connection=local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| - hosts: foo | |
| tasks: | |
| - debug: var=hostvars | |
| - debug: var=group_names |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PLAY [foo] ********************************************************************* | |
| TASK [setup] ******************************************************************* | |
| ok: [localhost] | |
| TASK [debug] ******************************************************************* | |
| ok: [localhost] => { | |
| "hostvars": { | |
| "localhost": { | |
| "ansible_all_ipv4_addresses": [ | |
| "192.168.2.190" | |
| ], | |
| "ansible_all_ipv6_addresses": [ | |
| "fe80::f3c6:7f5d:391:e860" | |
| ], | |
| "ansible_architecture": "x86_64", | |
| "ansible_bios_date": "03/23/2016", | |
| "ansible_bios_version": "R06ET36W (1.10 )", | |
| "ansible_check_mode": false, | |
| "ansible_cmdline": { | |
| "BOOT_IMAGE": "/vmlinuz-4.4.0-34-generic.efi.signed", | |
| "ro": true, | |
| "root": "/dev/mapper/ubuntu--mate--vg-root" | |
| }, | |
| "ansible_connection": "local", | |
| "ansible_date_time": { | |
| "date": "2016-08-26", | |
| "day": "26", | |
| "epoch": "1472231281", | |
| "hour": "13", | |
| "iso8601": "2016-08-26T17:08:01Z", | |
| "iso8601_basic": "20160826T130801604622", | |
| "iso8601_basic_short": "20160826T130801", | |
| "iso8601_micro": "2016-08-26T17:08:01.604690Z", | |
| "minute": "08", | |
| "month": "08", | |
| "second": "01", | |
| "time": "13:08:01", | |
| "tz": "EDT", | |
| "tz_offset": "-0400", | |
| "weekday": "Friday", | |
| "weekday_number": "5", | |
| "weeknumber": "34", | |
| "year": "2016" | |
| }, | |
| "ansible_default_ipv4": { | |
| "address": "192.168.2.190", | |
| "alias": "wlp4s0", | |
| "broadcast": "192.168.2.255", | |
| "gateway": "192.168.2.1", | |
| "interface": "wlp4s0", | |
| "macaddress": "44:85:00:9c:56:ee", | |
| "mtu": 1500, | |
| "netmask": "255.255.255.0", | |
| "network": "192.168.2.0", | |
| "type": "ether" | |
| }, | |
| "ansible_default_ipv6": {}, | |
| "ansible_devices": { | |
| "sda": { | |
| "holders": [], | |
| "host": "SATA controller: Intel Corporation Sunrise Point-LP SATA Controller [AHCI mode] (rev 21)", | |
| "model": "Samsung SSD 850", | |
| "partitions": { | |
| "sda1": { | |
| "sectors": "1048576", | |
| "sectorsize": 512, | |
| "size": "512.00 MB", | |
| "start": "2048" | |
| }, | |
| "sda2": { | |
| "sectors": "999424", | |
| "sectorsize": 512, | |
| "size": "488.00 MB", | |
| "start": "1050624" | |
| }, | |
| "sda3": { | |
| "sectors": "974721024", | |
| "sectorsize": 512, | |
| "size": "464.78 GB", | |
| "start": "2050048" | |
| } | |
| }, | |
| "removable": "0", | |
| "rotational": "0", | |
| "sas_address": null, | |
| "sas_device_handle": null, | |
| "scheduler_mode": "deadline", | |
| "sectors": "976773168", | |
| "sectorsize": "512", | |
| "size": "465.76 GB", | |
| "support_discard": "512", | |
| "vendor": "ATA" | |
| } | |
| }, | |
| "ansible_distribution": "Ubuntu", | |
| "ansible_distribution_major_version": "16", | |
| "ansible_distribution_release": "xenial", | |
| "ansible_distribution_version": "16.04", | |
| "ansible_dns": { | |
| "nameservers": [ | |
| "127.0.1.1" | |
| ], | |
| "search": [ | |
| "lan" | |
| ] | |
| }, | |
| "ansible_domain": "", | |
| "ansible_enp0s31f6": { | |
| "active": false, | |
| "device": "enp0s31f6", | |
| "macaddress": "50:7b:9d:f1:99:bb", | |
| "module": "e1000e", | |
| "mtu": 1500, | |
| "pciid": "0000:00:1f.6", | |
| "promisc": false, | |
| "type": "ether" | |
| }, | |
| "ansible_env": { | |
| "ARCHFLAGS": "-arch x86_64", | |
| "CLUTTER_BACKEND": "x11", | |
| "COLORTERM": "mate-terminal", | |
| "COMPIZ_CONFIG_PROFILE": "mate", | |
| "DBUS_SESSION_BUS_ADDRESS": "unix:abstract=/tmp/dbus-dwBUeQzPwH,guid=b2086ef271a52473f8a01aec57b62570", | |
| "DEFAULTS_PATH": "/usr/share/gconf/mate.default.path", | |
| "DESKTOP_SESSION": "mate", | |
| "DISPLAY": ":0", | |
| "EDITOR": "gvim", | |
| "GDMSESSION": "mate", | |
| "GDM_LANG": "en_CA", | |
| "GPG_AGENT_INFO": "/home/archf/.gnupg/S.gpg-agent:0:1", | |
| "GTK_MODULES": "gail:atk-bridge:canberra-gtk-module:topmenu-gtk-module", | |
| "GTK_OVERLAY_SCROLLING": "0", | |
| "HOME": "/home/archf", | |
| "LANG": "en_CA.UTF-8", | |
| "LANGUAGE": "en_CA:en", | |
| "LC_ALL": "en_CA.UTF-8", | |
| "LC_CTYPE": "en_CA.UTF-8", | |
| "LC_MESSAGES": "en_CA.UTF-8", | |
| "LESS": "-i -w -M -F -s -r", | |
| "LESSOPEN": "|/usr/bin/lesspipe %s", | |
| "LOGNAME": "archf", | |
| "LSCOLORS": "Gxfxcxdxbxegedabagacad", | |
| "MANDATORY_PATH": "/usr/share/gconf/mate.mandatory.path", | |
| "MATE_DESKTOP_SESSION_ID": "this-is-deprecated", | |
| "OLDPWD": "/home/archf/repos/ansible-bug", | |
| "PAGER": "less", | |
| "PATH": "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin", | |
| "PWD": "/home/archf/repos/ansible-bug", | |
| "QT_ACCESSIBILITY": "1", | |
| "QT_LINUX_ACCESSIBILITY_ALWAYS_ON": "1", | |
| "QT_STYLE_OVERRIDE": "gtk", | |
| "SESSION_MANAGER": "local/vl145666:@/tmp/.ICE-unix/3182,unix/vl145666:/tmp/.ICE-unix/3182", | |
| "SHELL": "/bin/zsh", | |
| "SHLVL": "2", | |
| "SSH_AGENT_PID": "3320", | |
| "SSH_AUTH_SOCK": "/run/user/1001/keyring/ssh", | |
| "TERM": "screen-256color", | |
| "TMUX": "/tmp/tmux-1001/default,6377,2", | |
| "TMUX_PANE": "%25", | |
| "TMUX_PLUGIN_MANAGER_PATH": "/home/archf/.tmux/plugins/", | |
| "USER": "archf", | |
| "WINDOWID": "60817445", | |
| "XAUTHORITY": "/home/archf/.Xauthority", | |
| "XDG_CONFIG_DIRS": "/etc/xdg/xdg-mate:/etc/xdg", | |
| "XDG_CURRENT_DESKTOP": "MATE", | |
| "XDG_DATA_DIRS": "/usr/share/mate:/usr/share/mate:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop", | |
| "XDG_GREETER_DATA_DIR": "/var/lib/lightdm-data/archf", | |
| "XDG_RUNTIME_DIR": "/run/user/1001", | |
| "XDG_SEAT": "seat0", | |
| "XDG_SEAT_PATH": "/org/freedesktop/DisplayManager/Seat0", | |
| "XDG_SESSION_DESKTOP": "mate", | |
| "XDG_SESSION_ID": "c2", | |
| "XDG_SESSION_PATH": "/org/freedesktop/DisplayManager/Session0", | |
| "XDG_SESSION_TYPE": "x11", | |
| "XDG_VTNR": "7", | |
| "ZSH": "/home/archf/.oh-my-zsh", | |
| "ZSH_TMUX_TERM": "screen-256color", | |
| "_": "/usr/bin/ansible-playbook", | |
| "_ZSH_TMUX_FIXED_CONFIG": "/home/archf/.oh-my-zsh/plugins/tmux/tmux.extra.conf", | |
| "tmux_conf_battery_symbol": "heart", | |
| "tmux_conf_battery_symbol_count": "5", | |
| "tmux_conf_theme": "powerline" | |
| }, | |
| "ansible_fips": false, | |
| "ansible_form_factor": "Notebook", | |
| "ansible_fqdn": "vl145666", | |
| "ansible_gather_subset": [ | |
| "hardware", | |
| "network", | |
| "virtual" | |
| ], | |
| "ansible_hostname": "vl145666", | |
| "ansible_interfaces": [ | |
| "lo", | |
| "wlp4s0", | |
| "enp0s31f6" | |
| ], | |
| "ansible_kernel": "4.4.0-34-generic", | |
| "ansible_lo": { | |
| "active": true, | |
| "device": "lo", | |
| "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": "xenial", | |
| "description": "Ubuntu 16.04.1 LTS", | |
| "id": "Ubuntu", | |
| "major_release": "16", | |
| "release": "16.04" | |
| }, | |
| "ansible_machine": "x86_64", | |
| "ansible_machine_id": "644062d47ee44a6a832897140a65ea20", | |
| "ansible_memfree_mb": 118, | |
| "ansible_memory_mb": { | |
| "nocache": { | |
| "free": 690, | |
| "used": 3144 | |
| }, | |
| "real": { | |
| "free": 118, | |
| "total": 3834, | |
| "used": 3716 | |
| }, | |
| "swap": { | |
| "cached": 15, | |
| "free": 3559, | |
| "total": 3979, | |
| "used": 420 | |
| } | |
| }, | |
| "ansible_memtotal_mb": 3834, | |
| "ansible_mounts": [ | |
| { | |
| "device": "/dev/mapper/ubuntu--mate--vg-root", | |
| "fstype": "ext4", | |
| "mount": "/", | |
| "options": "rw,relatime,errors=remount-ro,data=ordered", | |
| "size_available": 308310843392, | |
| "size_total": 486976602112, | |
| "uuid": "5c698833-91af-4518-a88f-217253ff1368" | |
| }, | |
| { | |
| "device": "/dev/sda2", | |
| "fstype": "ext2", | |
| "mount": "/boot", | |
| "options": "rw,relatime,block_validity,barrier,user_xattr,acl", | |
| "size_available": 292439040, | |
| "size_total": 495560704, | |
| "uuid": "98cdec3e-d895-4b6c-80ce-8f6984a6cfe3" | |
| }, | |
| { | |
| "device": "/dev/sda1", | |
| "fstype": "vfat", | |
| "mount": "/boot/efi", | |
| "options": "rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro", | |
| "size_available": 532049920, | |
| "size_total": 535805952, | |
| "uuid": "F349-EA0C" | |
| } | |
| ], | |
| "ansible_nodename": "vl145666", | |
| "ansible_os_family": "Debian", | |
| "ansible_pkg_mgr": "apt", | |
| "ansible_processor": [ | |
| "GenuineIntel", | |
| "Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz", | |
| "GenuineIntel", | |
| "Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz", | |
| "GenuineIntel", | |
| "Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz", | |
| "GenuineIntel", | |
| "Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz" | |
| ], | |
| "ansible_processor_cores": 2, | |
| "ansible_processor_count": 1, | |
| "ansible_processor_threads_per_core": 2, | |
| "ansible_processor_vcpus": 4, | |
| "ansible_product_name": "20FNCTO1WW", | |
| "ansible_product_serial": "NA", | |
| "ansible_product_uuid": "NA", | |
| "ansible_product_version": "ThinkPad T460", | |
| "ansible_python": { | |
| "executable": "/usr/bin/python", | |
| "has_sslcontext": true, | |
| "type": "CPython", | |
| "version": { | |
| "major": 2, | |
| "micro": 12, | |
| "minor": 7, | |
| "releaselevel": "final", | |
| "serial": 0 | |
| }, | |
| "version_info": [ | |
| 2, | |
| 7, | |
| 12, | |
| "final", | |
| 0 | |
| ] | |
| }, | |
| "ansible_python_interpreter": "/usr/bin/python", | |
| "ansible_python_version": "2.7.12", | |
| "ansible_selinux": false, | |
| "ansible_service_mgr": "systemd", | |
| "ansible_ssh_host_key_dsa_public": "AAAAB3NzaC1kc3MAAACBAO8/ALlL60LWORLkCUkgQGTGydOsh5hSlAv//GEPgOWwWTvtzukcS9CVRjyu5sIsGtSk6I0Ts65lkAfPqdPaMBK9Rnu7Y5ooeN1RxzPX5F+yXg4DsiUMwumhEfgeMtIWW8OyZVoAda2BEMcq+sON+S50DSmpz4qXEnbbqJOS+0HVAAAAFQDNrcDXvxebGBzw5XaSFIiXE1oNLQAAAIEArqoEc4uFEpB2NpO8C/FieRvNTHORFjJmNz7g4Y2vM//apWieLm4eJXc/oyoSC/562TwZ/2wmkg/eDFwKj5TuPxkf/7gQ4w0lKSAaPhZwU3OBAMpbfDrsk0JFVwcC36cBHivTaYvH5P8vEJgsUWVC0wyQfEOp2KEzipUVSXvFep4AAACBAKbZrPilNZmhWz/T6iKQ+TFScmL0G3UeWSHDj+QL6riRzfvqiVgeCuEPv28GVFXptKhDIYQTEYeS0wUSzwKgm8FgJJ0qZr1w3I4JJYwfR5m9DlT9rY0zlzgpkQFqw33HBUSFFLf/vCXBRhKjvlQppcxq7Ztbth7mKR/leo9mVSEb", | |
| "ansible_ssh_host_key_ecdsa_public": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBAdb78Au/ju7HYN4xRTjxMGJGbKKqWs0TosofqkgAgh7tfmr4AWC+OQifP6SgOsT4UMyBvcDGIk84w9FAq+yfjs=", | |
| "ansible_ssh_host_key_ed25519_public": "AAAAC3NzaC1lZDI1NTE5AAAAIJjpHCyfi04DwPP9yDLd/DcXZd/BRgfhvXNk0Zvs1XEn", | |
| "ansible_ssh_host_key_rsa_public": "AAAAB3NzaC1yc2EAAAADAQABAAABAQCrsmu4rj9ExP5GV+wGM6doFAjdMjb9TtjWEUzjOgjmzsCkD/clfzDtL0vJDY//OB9HnJAGGGLzqWSm8yYmRkPtpT2ozWaqCothmY5OJuCxUNqAuANE8LhLrqdEK0o78lrsvjboe0dcLCqOCBIOqDO7FF9yI1FQz9XszYPUgyNmbM7xf7Kq5pIfRBuB55bhj0AKbWfiz2Mpqa37qo74UR87YaU+uAtz9/CRSchDq0sxWUOvflBru4Kp3GOPnvU+nFEnVzsbBThPgQukTzTM8it7hwlcnC6NmHyyFdaodLx3ut+XDsIuzYgYvWYG/i/i8P81IIbjziO4VB9XuIooKybn", | |
| "ansible_swapfree_mb": 3559, | |
| "ansible_swaptotal_mb": 3979, | |
| "ansible_system": "Linux", | |
| "ansible_system_capabilities": [ | |
| "" | |
| ], | |
| "ansible_system_capabilities_enforced": "True", | |
| "ansible_system_vendor": "LENOVO", | |
| "ansible_uptime_seconds": 676366, | |
| "ansible_user_dir": "/home/archf", | |
| "ansible_user_gecos": "", | |
| "ansible_user_gid": 1001, | |
| "ansible_user_id": "archf", | |
| "ansible_user_shell": "/bin/zsh", | |
| "ansible_user_uid": 1001, | |
| "ansible_userspace_architecture": "x86_64", | |
| "ansible_userspace_bits": "64", | |
| "ansible_version": { | |
| "full": "2.1.1.0", | |
| "major": 2, | |
| "minor": 1, | |
| "revision": 1, | |
| "string": "2.1.1.0" | |
| }, | |
| "ansible_virtualization_role": "host", | |
| "ansible_virtualization_type": "kvm", | |
| "ansible_wlp4s0": { | |
| "active": true, | |
| "device": "wlp4s0", | |
| "ipv4": { | |
| "address": "192.168.2.190", | |
| "broadcast": "192.168.2.255", | |
| "netmask": "255.255.255.0", | |
| "network": "192.168.2.0" | |
| }, | |
| "ipv6": [ | |
| { | |
| "address": "fe80::f3c6:7f5d:391:e860", | |
| "prefix": "64", | |
| "scope": "link" | |
| } | |
| ], | |
| "macaddress": "44:85:00:9c:56:ee", | |
| "module": "iwlwifi", | |
| "mtu": 1500, | |
| "pciid": "0000:04:00.0", | |
| "promisc": false, | |
| "type": "ether" | |
| }, | |
| "group_names": [ | |
| "ungrouped" | |
| ], | |
| "groups": { | |
| "all": [ | |
| "localhost" | |
| ], | |
| "foo": [ | |
| "localhost" | |
| ], | |
| "ungrouped": [ | |
| "localhost" | |
| ] | |
| }, | |
| "inventory_dir": "/home/archf/repos/ansible-bug", | |
| "inventory_file": "local", | |
| "inventory_hostname": "localhost", | |
| "inventory_hostname_short": "localhost", | |
| "module_setup": true, | |
| "omit": "__omit_place_holder__a2bced5b98a11cbe0ff79d6137fd999742d4bd09", | |
| "playbook_dir": "/home/archf/repos/ansible-bug" | |
| } | |
| } | |
| } | |
| TASK [debug] ******************************************************************* | |
| ok: [localhost] => { | |
| "group_names": [ | |
| "foo" | |
| ] | |
| } | |
| PLAY RECAP ********************************************************************* | |
| localhost : ok=3 changed=0 unreachable=0 failed=0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment