How do you create a user in rabbitmq using hiera?

asked 2015-11-26 04:44:50 -0600

poysama gravatar image

updated 2015-11-26 04:46:30 -0600

As I have read, creating a user normally would look like

rabbitmq_user { 'admin_user':
    admin    => true,
    password => 'pass,
}

How do I do this if I use hiera? Using the example below doesn't seem to work

# hiera.yml
rabbitmq_user:
  name: 'admin_user'
  admin: true
  password: 'pass'

The only solution I can think of is forking and updating the rabbitmq module with a create_resources declaration like below

class rabbitmq(
  ...

  $users = {},

  ...
) {
  ...

  create_resources('rabbitmq_user', $users, {})

  ...
}

and have my hiera.yml look like

# hiera.yml
rabbitmq::users:
  'admin_user':
    admin: true
    password: 'pass'

Is this also a correct way of handling it? I assume if I do it this way then it creates a notion that hiera will be the default data provider? I use hiera to manage data across multiple servers that depend on facts. Is this to my advantage?

rabbitmq_user seems to be listed as a native type. What is a native type?

edit retag flag offensive close merge delete