Node declaration

Our first piece will be the node declaration. This will go in our site.pp, and each application will go under a specific site call. In the following sample, notice the following:

  • All apps are declared in the top-level site{} declaration.
  • myapp {'myapp': } is just one possible app that can go in site.pp. We could have another beneath it called myapp.{'myapp2': } is inside of the site, and has a second standalone instance of this application.
  • Node['<nodename>'] and Myapp::<app> are capitalized.
  • I can still use the site.pp for other things, as indicated by the classification of the Puppet Master, as follows:
site {
myapp { 'myapp':
nodes => {
Node['mysql'] => [ Myapp::Db['myapp']],
Node['appserver'] => [ Myapp::Web['myapp']],
Node['haproxy'] => [ Myapp::Lb['myapp']],
}
}
}

node 'puppetmaster' {
include role::puppetmaster
}

# To keep the sample simple, firewalls have been disabled on all machines.
service {'firewalld': ensure => stopped }
service {'iptables': ensure => stopped }

This particular configuration will ensure that the mysql node gets the database, appserver will get WordPress, and HAProxy will get the load balancer configuration.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.71.6