Skip to content

Group Variables

TF edited this page Feb 16, 2023 · 1 revision

About

This page describes Ansible group (i.e. Open-AudIT groups and location) variables only.

For host variables check out Host variables and for automatically mapped internal Open-AudIT fields see Auto-mapped Open-AudIT Variables.

The inventory plugin sedi.openaudit.inventory supports 2 ways of setting group based variables in Open-AudIT which then gets mapped to Ansible group vars.

Classic Groups (recommended)

Classic group variables support was introduced in v2.0.0 of sedi.openaudit and is the recommended approach to set group variables for Ansible.

In Open-AudIT one can specify groups which are a dynamic list of hosts based on a SQL query.
sedi.openaudit.inventory will collect all groups found for a device and parses the field Description of each group to find variables.

Open-AudIT configuration Format
Groups -> field: Description <free text which gets ignored> ;; <variable-name>=<value>; <next-var>=<value>
or without any description:
;; <variable-name>=<value>; <next-var>=<value>

The special indicator ;; is required so sedi.openaudit.inventory knows that everything on the right are variables to be parsed and so mandatory. Even if you do not set a description on the left of ;; you have to set ;; always.

Check also Variable inheritance to understand which variable wins during the parsing process.

Location based

Location variables support was introduced in v1.1.0 of sedi.openaudit. I would recommend using the "Classic groups" approach as it is more flexible, less hacky, more near to "Ansible thinking" and location based group vars might get dropped in the future.

If you still need a second level of group variables which you cannot fix by the "Classic groups" approach read on.

In Open-AudIT one can specify locations which then can be bound (statically) to a host.
sedi.openaudit.inventory will check the location set for a device and parses the field suite to find variables.

Open-AudIT configuration Format
Locations -> field: suite <free text which gets ignored> ;; <variable-name>=<value>; <next-var>=<value>
or without any description:
;; <variable-name>=<value>; <next-var>=<value>

The special indicator ;; is required so sedi.openaudit.inventory knows that everything on the right are variables to be parsed and so mandatory. Even if you do not set a description on the left of ;; you have to set ;; always.

Check also Variable inheritance to understand which variable wins during the parsing process.

Clone this wiki locally