Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9150529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:37:23+00:00 2026-06-17T11:37:23+00:00

New puppet user, trying to wrap my head around name spaces and so forth.

  • 0

New puppet user, trying to wrap my head around name spaces and so forth.

I am currently working on a module called user. It has a unixuser class and a unixgroup class in unixuser.pp and unixgroup.pp. I’ll limit my question to the creation of users.

init.pp currently only contains:

class user {
  class {'user::unixuser': }
  class {'user::unixgroup': }

  # Create groups before creating users
  Class['user::unixgroup'] -> ['user::unixuser']
}

In unixuser.pp and unixgroup.pp I only want to define the virtual resources. The functions that do this should be in functions.pp for readability.

Question 1: Should functions.pp should only contain definitions or should the definitions sit inside a class? So in code, should functions.pp contain this:

class user::functions {
  define login ($uid, $gid) {
    user { $title:
      ensure  => present,
      uid     => $uid,
      gid     => $gid,
    }
  }
}

Or should define login not be in the user::functions class? If so, should the define line be define user::login or something else?

Going further, unixuser.pp will then contain something similar to the following (incomplete) stanza:

class user::unixuser {
  @something { 'admin':
    uid => 1000,
    gid => 1000,
  }
}

If all of this is finished then I will realize the users from nodes.pp with something like realize User::Something['admin'].

Question 2: How should the class user::unixuser be made aware of the login function? Is this done by having class user::unixuser inherits user::functions or should I have include user::functions or class {'user::functions': } or…?

Question 3: Based on question 2, what comes in the place of @something when the user::unixuser class plays nicely with functions.pp?

I tried to formulate the question to the best of my abilities but if it is still a bit chaotic I apologize. 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:37:24+00:00Added an answer on June 17, 2026 at 11:37 am

    First off if a user is assigned to a group that group is auto required, so you shouldn’t need the following,:

      # Create groups before creating users
      Class['user::unixgroup'] -> ['user::unixuser']
    

    functions.pp looks fine try the following in init.pp:

    class user {
      include user::functions
      include user::unixgroup
      include user::unixuser
    }
    

    and unixuser.pp:

    class user::unixuser {
      login { 'admin':
        uid => 1000,
        gid => 1000,
      }
      ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am very new to puppet and just trying to understand what the output
I'm new to Puppet and have a question about working with dependencies. I'm using
Very new to puppet here. Suppose: define add_user ($shell) { $username = $title user
new to c#. I'm trying to make a simple system where I can search
New to Node.js and Express, I am trying to understand the two seems overlapping
New programmer here, I am trying to understand and break down this code below
New to wordpress and web design in general. I'm trying to setup a website
new to python here. I am trying to write a program that calculate the
New to bash scripting, The previous answers didn't helped me. I am trying to
New to Python and trying to figure out what went wrong here. Making a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.