Use multiple var files in ansible role
<p>One of my roles has two different variable types. One is public (things like package versions and other benign information). These can be committed to SCM without a worry. It also requires some private information (such as API keys and other secret information). I'm using <code>ansible-vault</code> to encrypt secret information. My solution was to have <code>vars/main.yaml</code> for pulic, and <code>vars/vault.yml</code> for the encrypted private information.</p>

<p>I came across a problem and am uncertain what's the best practice or actual solution here. It seems that ansible only loads the <code>vars/main.yml</code> file. Naturally I do not want to encrypt the public information so I looked for solution. So far the only solution I came up with (suggested on IRC) is to create <code>group_vars/all/vault.yml</code> and prefix all variables with the role name. This works because ansible seems to recursively load everything under <code>group_vars</code>. This does work but seems organizationally incorrect because the variables are for a <em>specific</em> role and not "globally universally true". I also tried to put <code>include: vars/vault.yml</code> into <code>vars/main.yml</code> but that did not work.</p>

<p>Is there a proper way to do this?</p>