Ask Your Question

Class init.pp not working

asked 2016-03-22 22:36:09 -0600

anfield gravatar image

updated 2016-03-22 22:50:05 -0600

Created a module called addusers. Inside the init.pp file (inside manifests) I have created a class called mitchell.pp When I run the apply there are no errors but it does nothing. What am i missing?

init.pp contains -

 class users {
        user {'mitchell':
                ensure => present,
                uid => '1009',
                gid => '1000',
                shell => '/bin/bash',
                home => '/home/mitchell'
edit retag flag offensive close merge delete


Only works If I remove the first line - class users { and the corresponding end bracket -> }

anfield gravatar imageanfield ( 2016-03-22 22:48:56 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted

answered 2016-03-22 22:54:53 -0600

You're not including (declaring) the class anywhere; you're only defining it. It's a bit like defining a function in shell, and then not actually calling it.

You could have it defined and included by adding a line at the end:

include users

Don't do that though. You'll be best served by learning more about Puppet module fundamentals. In practice, you'll hopefully end up writing a special class called a profile to include your user class somewhere.

edit flag offensive delete link more


Ok..when I dropped the brackets from the tests directory init.pp and just had include users, it worked fine. Thanks

anfield gravatar imageanfield ( 2016-03-23 08:32:49 -0600 )edit

You're welcome. Could you mark the issue as resolved then? Thanks

Alex Harvey gravatar imageAlex Harvey ( 2016-03-23 09:40:48 -0600 )edit

answered 2016-03-23 08:27:53 -0600

anfield gravatar image

Hi. So I could do what you stated above or I could add something in my tests directory? I tried - include classusers {} or class addusers { } in my init.pp inside the tests directory, neither of these worked. (All this was done on the master.


edit flag offensive delete link more

answered 2016-03-25 17:23:30 -0600

kalyan gravatar image

The class name should be your module name

for init.pp (addusers/manifests/init.pp)

class addusers {

rest of the code here


suppose if you had mitchell.pp (addusers/manifests/mitchell.pp)

class addusers::mitchell {

Rest of the code here


edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-03-22 22:36:09 -0600

Seen: 317 times

Last updated: Mar 23 '16