Skip to content
Discussion options

You must be logged in to vote

@IAMSolaara When looping over maps, we make the {{.KEY}} variable available for use. You can see this in our looping over variables documentation. e.g.

tasks:
  map_test:
    vars:
      NODES_MAP:
        map:
          foo: { type: a }
          bar: { type: a }
          baz: { type: b }
    cmd:
      for: { var: NODES_MAP }
      cmd: "echo map key: {{.KEY}} - {{.ITEM}}"

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@IAMSolaara
Comment options

Answer selected by IAMSolaara
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants