Skip to content

Variables to normal groups

Stefan Berggren edited this page May 16, 2015 · 4 revisions

Normal group variables are defined inline like this:

root:
  site:
    docker:
      hosts:
        - dockerhost1.example.com
      vars:
        foo: 2
    vars:
      foo: 1

The variable foo is set to 1 to the group site, and 2 to docker. The variable will be 2 on the host dockerhost1 because normal groups are hierarchical.

Also note the use of hosts in this example. You can't mix lists and dicts in YAML so this is a workaround for that. These two examples are identical:

root:
  - myhost
root:
  hosts:
    - myhost
Clone this wiki locally