Skip to content

Instantly share code, notes, and snippets.

@antaflos
Created March 20, 2014 20:45
Show Gist options
  • Save antaflos/9673440 to your computer and use it in GitHub Desktop.
Save antaflos/9673440 to your computer and use it in GitHub Desktop.
is it possible to call a Puppet function like postgresql_password() when looking up data from Hiera (and using create_resources())?
---
profile::postgresql::server::dbs:
redmine:
user: redmine
password: "postgresql_password('redmine', 'xxx')"
# The above results in puppetlabs-postgresql's Postgresql::Server::Role class
# passing the string "postgresql_password('redmine', 'xxx')" verbatim as
# ENCRYPTED PASSWORD to the ALTER ROLE statement postgresql_psql creates, which of course fails.
# modules/profile/manifests/postgresql/server.pp
class profile::postgresql::server {
include '::postgresql::server'
include '::postgresql::server::contrib'
include '::postgresql::globals'
$dbs = hiera_hash('profile::postgresql::server::dbs', {})
create_resources('::postgresql::server::db', $dbs)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment