define keystone_user from openstack/puppet-keystone via hiera? -


i using https://github.com/openstack/puppet-keystone set openstack management/controller node. need add 'glance' user keystone. want try , as can in hiera data manifest simple.

here manifest:

class kilo2_keystone {     include controller_ceph     include keystone     include keystone::config     include keystone::user #    keystone_user { 'glance': #        ensure => present, #    }  } 

the commented out section works, want able include keystone::user , supply parameters in hiera data so:

keystone::user:     "%{hiera('glance_admin_user')}":       ensure: present 

but when run puppet agent -t on node error:

could not find class ::keystone::user 

the commented-out code declares resource of type keystone_user, not class. presumably type, keystone_user, provided puppet-keystone module. include() family of functions declaring classes, not resources, inapplicable keystone_user.

there more 1 way proceed. if don't anticipate wanting more complicated declaring 1 or more keystone_users present, i'd recommend giving class parameter user name(s), can assign value via hiera:

class kilo2_keystone($usernames = []) {   include controller_ceph   include keystone   include keystone::config    keystone_user { $usernames:     ensure => present,   } } 

on other hand, if want able declare multiple users, each own set of attributes, create_resources() function path of least resistance. still want parameterize class gets data hiera via automated data binding, want data structured differently, described in create_resources() docs: hash mapping resource titles (usernames, in case) inner hashes of resource parameters corresponding values.

for example, class might this:

class kilo2_keystone($userdata = {}) {   include controller_ceph   include keystone   include keystone::config    create_resources('keystone_user', $userdata) } 

the corresponding data class might this:

kilo2_keystone::userdata:   glance:     ensure: present     enabled: true   another_user:     ensure: absent 

note placing kilo2_keystone class in top scope. ought put in module , assign module's namespace. latter this:

class mymodule::kilo2_keystone($userdata = {}) {   # ... } 

Comments