Reputation: 2692
I'm very new to the concepts of using puppet and was just wondering if anyone could help me to think properly about how to go about installing new software onto my server.
For example, if I want to put "postgres" on my server, how should I go about figuring out how to use puppet to accomplish this?
Again, I'm not asking specifically about postgres, but any package. (Although a postgres example would be great.) I'd really like it if I could install all my stuff using the manifest file. For example, here is how I installed apache2:
package {
'apache2': ensure => installed
}
service {
'apache2':
ensure => true,
enable => true,
require => Package['apache2']
}
Just give me a brief explanation of what URLs i should check out to figure these things out for myself...
Teach me to fish :)
EDIT:
Upvotes: 1
Views: 224
Reputation: 2953
You should start thinking on how you would install these things without puppet, then you can write a puppet manifest that does that or find one that does what you're expecting.
1 and 2: The package type in puppet has a few providers (apt, yum, etc) and puppet will choose the one available in the OS you're installing.
3: Puppet has a few "native" types that you can find in the docs. Using this types you can write a manifest that would do exactly what you would do manually.
F.E. if you would just run apt-get install apache2
then all you have to do is package { 'apache2': ensure => installed }
, however when installing something that requires more steps, like nginx from source, then you need to get the installation instructions and convert to the appropriate exec
, file
and service
.
Another great source of information about puppet are the forge modules, mostly are available on github so you can check how they works.
Upvotes: 1
Reputation: 16826
The best way to go with this is to use already written modules.
Apache might be only a package but how can you further configure it.
I suggest using the default forge repository for modules Puppetforge
Over there you will find too many modules for every packge or service you want to use.
There are also some example42 modules that are nice...
A small example of what I am talking about. Let's say you have apache setup and you want to install php modules. That will require apache to restart and so on. That can become quite cumbersome to maintain.
Code:
include apt, apache
# Enable rewrite module
apache::module { 'rewrite': }
# Add MySQL, curl and xdebug modules
php::module { 'mysql': }
php::module { 'curl': }
php::module { 'xdebug': }
# Set php ini params
php::ini { 'xdebug-remote':
value => [
'xdebug.remote_enable = 1'
],
notify => Service['apache'], # this sets up the relationship
}
php::ini { 'security' :
target => 'security.ini',
value => [
'session.cookie_httponly = 1',
'session.cookie_secure = 0',
'allow_url_fopen = 0',
'expose_php = 0',
'max_input_vars = 250',
'disable_functions = exec,passthru,shell_exec,system,proc_open,popen,show_source'
],
notify => Service['apache'], # this sets up the relationship
}
Regarding your questions:
Also keep in mind that puppet is additive. That means that if you remove the line that installs apache that doesn't mean an uninstall of apache, an thus in an already provisioned system will remain present.
Upvotes: 1
Reputation: 917
The apache2
package comes from your distribution package manager, and is not something special to Puppet. You will need to check its documentation to see what other packages are available.
But the best thing you might do to get started is to check the puppet forge, where you will find ready to use packages.
Upvotes: 0