Skip to content

Variable inheritance

TF edited this page Dec 16, 2022 · 4 revisions

About

This plugin makes some assumptions and decisions which are explained here. It tries to keep closely what you might expect by Ansible and so should hopefully makes things easy to understand. The main principle is that a local file should have more power then a group variable defined in an Open-AudIT location but the variable defined in a device should be the one with the most power.

inheritance (next overwrites the previous):

  1. Open-AudIT -> Location -> field "Suite" (suite internally)
  2. Variables from the compose* definition. Taken from the config file specified by -i <hosts.openaudit.yml>
  3. Open-AudIT -> Fields -> <your custom field> (must be set in a device's config)

Example

If you specify

  • myvar="set_in_location" in an Open-AudIT location (see above)

Then myvar will have the value: set_in_location. You keep that variable in the Open-AudIT location and now specify the same variable but here, too:

  • in the compose* definition of a local config file (something.openaudit.yml)
compose:
  myvar: set_in_compose

Then myvar will have the value: set_in_compose.

You keep that variable in the Open-AudIT location and in the compose section and now specify the same variable but here, too:

  • in Open-AudIT -> add a custom field named myvar. You open the device in Open-AudIT and set the value of that custom field (open custom fields from the left menu) to set_in_device.

Then myvar will have the value: set_in_device (for all devices having that variable set)

Again: You still have the above location/suite var and the local config file with the same variable name but the device wins. Like host variables in Ansible itself.

[*] note: compose is not capable of matching variables based on conditions. That means every(!) hosts will get the variable as long as it is itself valid. Just keep this in mind.

Clone this wiki locally