Ask Your Question
0

correctly configure site.pp

asked 2014-10-28 18:15:01 -0500

jimsonpai gravatar image

updated 2014-10-29 10:51:50 -0500

spuder gravatar image

Hi, I was told to "use site.pp for your classification, in the node def for your master you need to add include puppetdb and include puppetdb::master::config.". I am new to puppet and not sure about the syntax. I want to know 1) is my syntax correct? If not what's the right syntax. 2) in the future how do I test whether my syntax is right? I can't imagine me asking you guys to check my work all the time.

node default {
        package { 'apache2':
                ensure => installed
        }

        service { 'apache2':
                ensure => true,
                enable => true,
                require => Package['apache2']
        }
}

master {
  include puppetdb
  include puppetdb::master::config
}
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-10-29 11:01:14 -0500

spuder gravatar image

updated 2014-10-29 11:05:07 -0500

To test your puppet manifest, use the following command

puppet parser validate foo.pp

In your example, there are a couple of things you should consider tweaking.

  1. Always use trailing commas.

While you don't need a comma after the last line, it is very easy to run into problems when you append the resource.

Consider changing this:

    service { 'apache2':
            ensure => true,
            enable => true,
            require => Package['apache2']
    }

to this better syntax:

    service { 'apache2':
            ensure => true,
            enable => true,
            require => Package['apache2'],
    }

Also, what is 'master'? Is this a node? If so, you'll need to prepend it with the word node and wrap it in single quotes

node 'master' {
  include puppetdb
  include puppetdb::master::config
}

Here are some additional resources

puppet module best practices

puppet parser validate

http://puppet-lint.com

site.pp

edit flag offensive delete link more

Comments

Master means the puppetmaster vm I am using. Its not one of the nodes name.

jimsonpai gravatar imagejimsonpai ( 2014-10-29 12:58:08 -0500 )edit

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

Stats

Asked: 2014-10-28 18:15:01 -0500

Seen: 42 times

Last updated: Oct 29 '14