question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Second Edition: an extra example requested (page 96)

See original GitHub issue
  • On page 96 you show a debug task - displaying the variable ansible_eth0
  • Later you show how to access an attribute of this variable:
{{ ansible_eth0.ipv4.address }}
{{ ansible_eth0['ipv4']['address'] }}
  • I have a similar variable - with an element like: {{ ansible_eth0.ipv6 }}

However, I have not figured out how to access ipv6 address of “fe80::…”

  • In the debug information ipv4 is { “address”: “value”, “netmask”: “value”, … }
  • but ipv6 first element is `[ { “address”: “value”, … } ], “macaddress”: “value”, …

I keep struggling over the additional [ ...] bracketing - and would really appreciate a concise explanation of this syntax.

Update: I want to make much more use of ansible_facts and use readily available information such as:

        "en0": {
            "device": "en0",
            "flags": [
                "UP",
                "BROADCAST",
                "NOTRAILERS",
                "RUNNING",
                "SIMPLEX",
                "MULTICAST",
                "GROUPRT",
                "64BIT",
                "CHECKSUM_OFFLOAD(ACTIVE)",
                "LARGESEND",
                "CHAIN"
            ],
            "ipv4": [
                {
                    "address": "192.168.129.64",
                    "broadcast": "192.168.129.255",
                    "netmask": "255.255.255.0",
                    "network": "192.168.129.0"
                },
                {
                    "address": "192.168.127.64",
                    "broadcast": "192.168.127.255",
                    "netmask": "255.255.255.0",
                    "network": "192.168.127.0"
                },
                {
                    "address": "10.1.0.77",
                    "broadcast": "10.1.1.255",
                    "netmask": "255.255.254.0",
                    "network": "10.1.0.0"
                }
            ],
            "ipv6": [
                {
                    "address": "fe80::fff1:feff:fea3:c744",
                    "prefix": "64"
                }
            ],
  • I’d rather not have to take a course on Python programming to understand how to quickly work through dict(s) containing lists of dicts (containing dicts containing lists of dicts - or is it lists containing dicts of lists, etc…

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
aixtoolscommented, Jan 20, 2022
  • (I) Don’t take it personally.
  • you are an author - and extremely experienced
  • my humble goal is to give a peek into the novice’s mind - and where it gets frustrating.
0reactions
geerlingguycommented, Jan 17, 2022

@aixtools - I may consider expanding more on the basics of extracting variables from ansible_facts and the like, but please don’t take the closure of this issue personally, it’s just that the topic of debugging + grabbing values from various places in Ansible’s fact-gathering mess already takes me way more time than it should too…

Read more comments on GitHub >

github_iconTop Results From Across the Web

School, Family, and Community Partnerships: Your Handbook ...
The book presents a research-based framework and field-tested tools to help leaders understand six types of family and community involvement; create an. Action ......
Read more >
Calculate a vCPU limit increase request for an Amazon EC2 ...
10xlarge instances = 40 vCPU per instance. Therefore, the additional number of vCPUs needed is calculated as follows: [2 * 8] + [2...
Read more >
Application for the Michigan Historical License Plate (BDVR-96)
I certify this historical vehicle is owned solely as a collector's item and is used only for historical club activities, parades, car shows,....
Read more >
RFC 1996: A Mechanism for Prompt Notification of Zone ...
RFC 1996 DNS NOTIFY August 1996 must ignore all messages for which this is not the case. 3.3. NOTIFY is similar to QUERY...
Read more >
Standard Form 86 - Questionnaire for National Security - OPM
This form will be used by the United States (U.S.) Government in conducting background investigations, reinvestigations, and continuous evaluations of.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found