How can i include other var files in a yaml file with only variables defined

Hi,

I use simple YAML files for defining some constant values to be used in my playbooks. A typical file would look like this:

var1: abc
var2: xyz
var3:

  • item1
  • item2
    var4:
    4.1: a
    4.2: b

I simply include the the file(s) like above in my playbooks in vars: section and all the constant values are available to me. Now i have a situation where i would like to break my vars file into several sub categories and include them all in one main vars file. I expect that i will have to include this one var file and others would be imported by this var file. I used include statement to have this:

  • include: subvars1.yaml
  • include: subvars2.yaml

var1: abc
var2: xyz
var3:

  • item1
  • item2

But this one is failing with some syntax error message.
How can i include another vars file into one vars only file ?

You cannot, YAML does not have an include feature.