camptocamp / puppet-accounts

11 stars 40 forks source link

Avoiding "Duplicate declaration" for accounts class ? #49

Closed jschaeff closed 7 years ago

jschaeff commented 7 years ago

Hi,

maybe I'm not using this module as intended. I have a profile "base" declaring:

class profiles::auth::local {
  class { 'accounts':
    ssh_keys   => hiera_hash('accounts::ssh_keys', {}),
    users      => hiera_hash('accounts::users', {}),
    usergroups => hiera_hash('accounts::usergroups', {}),
  }
  accounts::account{'xunil':
    authorized_keys => ['@admin']
  }
  accounts::account{'root':
    authorized_keys => ['@admin'],
  }
  accounts::account{'@admin':}
}

How would I deploy other users from another profile class ?

The problem is that if I redeclare the "class{'accounts':}" part in another profile and add the auth::local and the new profile to a same role, there will be a duplicate declaration of this class. I can not afford to create different profiles for different accounts deployment, how can I work around this issue ?

Thanks

jschaeff commented 7 years ago

Got it, this is working:

include profiles::auth::local
accounts::account{'bob':}

as simple as that ...