<\/span><\/h2>\nFirst, verify the Puppet service by running the following command on the Puppet master node. We need to make sure that the service is active and running:<\/p>\n
systemctl status puppetserver<\/pre>\nNext, list all of the signed and unsigned agent requests with the following command:<\/p>\n
\/opt\/puppetlabs\/bin\/puppetserver ca list --all<\/pre>\nYou should see the following output:<\/p>\n
Signed Certificates:\n puppet-client (SHA256) 58:73:AE:62:04:9E:B8:0F:16:07:83:08:34:4A:00:D2:E6:82:9B:47:2A:00:9F:F4:08:AE:56:A8:E7:1B:6A:31\n puppet-master (SHA256) 7F:23:98:18:0E:3F:0F:FD:3E:12:FD:43:A6:50:C2:4C:58:0F:C6:EB:B0:5A:2A:74:6F:D8:A0:95:BC:31:EA:47\talt names: [\"DNS:puppet-master\", \"DNS:puppet-master\"]\tauthorization extensions: [pp_cli_auth: true]\n<\/pre>\nOn the Puppet agent node, run the following command to test the connectivity between both nodes.<\/p>\n
\/opt\/puppetlabs\/bin\/puppet agent --test<\/pre>\nIf everything is fine, you should get the following output:<\/p>\n
Info: Using configured environment 'production'\nInfo: Retrieving pluginfacts\nInfo: Retrieving plugin\nInfo: Retrieving locales\nInfo: Caching catalog for puppet-client\nInfo: Applying configuration version '1583136740'\nNotice: Applied catalog in 0.05 seconds\n<\/pre>\n<\/span>Create a LAMP Module<\/span><\/h2>\nFirst, you will need to create a LAMP module on the Puppet master node. To create a module, you must create a directory whose name matches your module name in Puppet’s modules<\/code> directory, and it must contain a directory called manifests<\/code>, and that directory must contain an init.pp<\/code> file.<\/p>\nTo do so, change the directory to the Puppet module directory and create a directory named lamp<\/code> and then a manifests<\/code> directory inside it:<\/p>\ncd \/etc\/puppetlabs\/code\/modules\/\nmkdir -p lamp\/manifests<\/pre>\nNext, create a init.pp<\/code> file that will contain a Puppet class that matches the module name. We’re going to use nano<\/code> for this, but you can use any text editor you like.<\/p>\nnano lamp\/manifests\/init.pp<\/pre>\nAdd the following lines:<\/p>\n
class lamp {\n # execute 'apt-get update'\n exec { 'apt-update': # exec resource named 'apt-update'\n command => '\/usr\/bin\/apt-get update' # command this resource will run\n }\n\n # install apache2 package\n package { 'apache2':\n require => Exec['apt-update'], # require 'apt-update' before installing\n ensure => installed,\n }\n\n # ensure apache2 service is running\n service { 'apache2':\n ensure => running,\n }\n\n # install mysql-server package\n package { 'mysql-server':\n require => Exec['apt-update'], # require 'apt-update' before installing\n ensure => installed,\n }\n\n # ensure mysql service is running\n service { 'mysql':\n ensure => running,\n }\n\n # install php package\n package { 'php':\n require => Exec['apt-update'], # require 'apt-update' before installing\n ensure => installed,\n }\n # ensure info.php file exists\n file { '\/var\/www\/html\/info.php':\n ensure => file,\n content => '', # phpinfo code\n require => Package['apache2'], # require 'apache2' package before creating\n }\n}\n<\/pre>\nSave and close the file when you are finished.<\/p>\n