Hello all,
Given the following, let’s say part of a host_vars or group_vars definition file (YAML):
ssh_listen_port: 22
other_generic_var: alpha
sites:
-
name: the_domain
repository: git@github.com…project.git
instances:
production:
alpha: bravo
charlie: 123
db:
database: the_domain
user: the_domain
pass: the_domain_db_pw
secrets:
separate_file_a:
secret1: ! ‘’
secret2: ! ‘’
separate_file_b:
secret1: ! ‘’
secret2: ! ‘’ -
name: another_domain
…
… and so on …
How can I use separate templates for writing out vars contained within ‘secrets’, or can I? Searched high and low, tried a variety of different things - it needs to write the “secrets” data to separate files (not a requirement of mine so I can’t get around it) and logically it makes sense, in the data structure, to keep it as a property of the “site” itself. I’m working on a custom module for it now, if that’s the best way to go then I’ve already got a head start (although my implementation around reading the data feels brittle), but wondering if there was an easier/better way…
Thanks!