Link to the dictionary of Siberian barley

I am trying to organize variable definitions for downloadable books.

Example:

a_b: "a b"
a_c: "{{a_b}} c"

It works great.

Trying to turn this into a dict:

a:
  b: "a b"
  c: "{{a.b}} c"

Unfortunately, this leads to an error that a.bis undefined.

Is it technically possible to refer to kinship elements in a dict?

+4
source share
2 answers

You cannot reference variables during the variable phase "init". You can use set_factfor reference {{ a.b }}.

+2
source

, sibling, / YAML ,

a:
  b: &anchor_b "a b"
  c: *anchor_b

:

a:
  b: "a b"
  c: "a b"

, ec2, ec2 :

create_ec2_instance:
  tags: &tags
    env: "prod"
    role: "database"
    cluster: "backend-db"
    owner: "me"
  count_tag: *tags
+2

Source: https://habr.com/ru/post/1622087/


All Articles