1

Firstly, to be honest I'm pretty new to Puppet world. I'm trying to build a puppet script for my server.

here how my puppet structure look like this

.
|-- environments
|   `-- example_env
|       |-- manifests
|       |-- modules
|       `-- README.environment
|-- manifests
|   |-- node.pp
|   `-- site.pp
|-- modules
|   |-- nginx
|   |   `-- manifests
|   |       `-- nginx.pp
|   |-- sudoers
|   |   |-- files
|   |   |   `-- sudoers
|   |   `-- manifests
|   |       `-- sudoers.pp
|   `-- users
|       `-- manifests
|           `-- users.pp
|-- puppet.conf
`-- templates

here how my node.pp and site.pp look like this.

# /etc/puppet/manifests/node.pp
node werain {
  include sudoers
} 

and

 # etc/puppet/manifests/site.pp
 import 'node.pp'

and finally my sudoers.pp file look like this.

# /etc/puppet/modules/sudoers/manifests/sudoers.pp
class sudoers {
  file { '/etc/sudoers':
    mode: '0400',
    source: 'puppet:///modules/sudoers/sudoers',
    owner: 'root',
    group: 'root'
  }
}

Any clue what I'm doing wrong.

I'm running the puppet command like this.

puppet apply /etc/puppet/manifests/site.pp --modulepath=/etc/puppet/modules/

my puppet version is 3.8.4

2

when you build a module you need to have an init.pp file in the manifests directory.

Rename to look like this:

# /etc/puppet/modules/sudoers/manifests/init.pp
class sudoers {
  file { '/etc/sudoers':
    mode: '0400',
    source: 'puppet:///modules/sudoers/sudoers',
    owner: 'root',
    group: 'root'
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.