How to append something to the fact that gets returned via hiera
claflico opened this issue · comments
Sorry to ask but been searching for the past 2-3 hours. Am trying to make my module manifests as generic as possible and store as much in hiera as I can.
How can I manipulate (add/remove text) the facts that get returned as part of a hiera lookup? For example, the mongo profile module I'm using looks for the following when setting up replica sets:
mongodb_replset_members:
- 'iam-dev-modb01.example.com:27017'
- 'iam-dev-modb02.example.com:27017'
- 'iam-dev-modb03.example.com:27017'
So I came up with the following puppetdb hiera query, however I need to be able to add port 27017 to the end of every hostname/fqdn that gets returned from the query:
mongodb_replset_members::_nodequery: ['project=iam and tier=dev and role=modb']
Thanks
I think the only way to do this would be to create a wrapper class and run the regsubst
function in there. I don't have any plans really to add such functionality to the hiera backend. Seems like it would be a bit much like putting code into the hiera data.