WebLogic Hackathon: Automated Provisioning using Puppet
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share

WebLogic Hackathon: Automated Provisioning using Puppet

  • 4,193 views
Uploaded on

This presentation accompanies a hands-on-lab session in which Puppet will be used to automatically provision Oracle WebLogic Server. Puppet is a tool to automate configuration management. Together......

This presentation accompanies a hands-on-lab session in which Puppet will be used to automatically provision Oracle WebLogic Server. Puppet is a tool to automate configuration management. Together with Chef it's one of the more popular configuration management tools at the moment. Puppet allows you to describe the desired (to-be) state of your servers by declaring resources. These declarations can describe user accounts, security settings, packages, directories, files, executable statements, services, and so on. Manifests are the files in which resource declarations are listed. Puppet periodically applies manifests by translating manifests into specific commands (catalogs) and executes those on the managed servers. Puppet is capable of inspecting the machines so it only applies those changes that are necessary. If a machine is already in the desired state Puppet will apply no changes.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
No Downloads

Views

Total Views
4,193
On Slideshare
3,006
From Embeds
1,187
Number of Embeds
9

Actions

Shares
Downloads
85
Comments
3
Likes
3

Embeds 1,187

http://blog.vennster.nl 1,111
http://vennster1.rssing.com 28
https://twitter.com 26
http://jmmiddleware.wordpress.com 13
http://feedly.com 4
http://webcache.googleusercontent.com 2
http://www.linkedin.com 1
http://1766203392912336249_e68cdec9141f56ae719c763942cbe1e1ef72d229.blogspot.com 1
http://www.inoreader.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Super Sunday | WebLogic Hackathon Provisioning WebLogic using Puppet Ronald van Luttikhuizen December 1st | UKOUG Tech 2013 1 | 10 9
  • 2. Important ! | Before you start … The powerpoint for this hands-on-lab contains several tasks for the participants. Most of the tasks are explained in more detail in the sheets following the task description. So make sure you inspect the next sheets before starting on a new task  A lot of tasks in this hands-on-lab depend on the use of “vi” as text editor. Please help each other (you’re working in teams of three) or shout for help if you don’t know vi. Of course you are allowed to use other text editors as well  2 | 10 9
  • 3. Agenda Labs 1. 2. 3. 4. 5. 6. Setup & preparation Puppet Hello World Provision JDK 7 using Puppet (and reusing the silent install scripts) Provision WebLogic Server 12c using Puppet (and reusing the silent install scripts) Bonus (1): Rewrite the Puppet modules (3 and 4) so we use native Puppet declarations instead of executing shell scripts Bonus (2): Expand the Puppet “weblogic” module (4) with additional logic References 1. 2. 3. 4. 5. Running PuTTY on Windows to edit files and run commands on VM Running WinSCP on Windows to copy and move files to and from VM Puppet Master installation Puppet Agent installation Useful Puppet commands and links 3 | 10 9
  • 4. Labs SETUP & PREPARATION 4 | 10 9
  • 5. provisioning VM “UKOUG13_PuppetAgent1” provisioning WLS 12c puppet catalogs Puppet Enterprise (Agent 2) JDK 7 WLS 12c VM “UKOUG13_PuppetAgent2” 5 | 10 9 provisioning Puppet Enterprise (Agent 1) JDK 7 WLS 12c VM “UKOUG13_PuppetMaster” provisioning provisioning puppet catalogs JDK 7 Browser provisioning Setup dashboard Puppet Enterprise (Master incl. DB and Dashboard)
  • 6. Setup Hostnames Puppet Master  puppetmaster.localdomain ● State: Puppet Enterprise already installed ● Dashboard username/password: master@ukoug.org/welcome1 Puppet Agent 1  puppetagent1.localdomain ● State: Puppet Enterprise installed, but not yet configured Puppet Agent 2  puppetagent1.localdomain ● State: Puppet Enterprise installed, but not yet configured 6 | 10 9
  • 7. Preparation Summary Form teams of three; decide who will run the Puppet Master VM (1x), and who will run the Puppet Agent VMs (2x) Download and/or install the necessary software Perform a connectivity test since the Agents need to be able to connect to the Master and vice versa. Inspect the Puppet Dashboard 7 | 10 9
  • 8. Preparation Form teams of 3 persons One person is going to run a node with the Puppet Master (also acts as local Puppet Agent) ● VM requires 4GB of RAM Two persons are going to run a node with a Puppet Agent ● VM requires 2GB of RAM All three will rollout a working Oracle WebLogic Server 12c environment including JDK 7 using Puppet 8 | 10 9
  • 9. Preparation Start downloads of required software Oracle VirtualBox 4.3.2+ and VirtualBox Extension Pack 4.3.2+  Required to run VMs ● ● Download URL: https://www.virtualbox.org/wiki/Downloads Action: Install on host machine PuTTY  Command-line tool that can be useful to interact with VMs from Windows ● ● Download URL: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html Action  Install on host machine (optional) WinSCP  Tool that can be useful to copy and move files between host (Windows) and VMs ● ● Download URL: http://winscp.net/eng/download.php Action: Install on host machine (optional) JDK 7u45 Linux i586 (tar.gz)  Will be provisioned on VMs using Puppet ● ● Download URL: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html Action: Copy to /software directory of your VM using e.g. WinSCP WebLogic 12c (12.1.2) Generic  Will be provisioned on VMs using Puppet ● ● Download URL: http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-for-dev-1703574.html Action: Copy to /software directory of your VM using e.g. WinSCP Already present Puppet Enterprise (installed on the Puppet Master and the Puppet Agents) 9 | 10 9
  • 10. Preparation | import appliance into VirtualBox Puppet Master (1 person) Import “UKOUG_2013_Puppet_Master.ova” Puppet Agent (2 persons) Import “UKOUG_2013_Puppet_Agent.ova” 10 | 10 9
  • 11. Preparation | import appliance into VirtualBox 11 | 10 9
  • 12. Preparation | import appliance into VirtualBox Make sure that you put a check mark in "Reinitialize the MAC address of all network cards". If you do not do this we will end up with several machines with the same MAC address which can mean that the network will not work. Make sure that you allocate at least 4096 MB for the Puppet Master, and 2048 MB for the Puppet Agent. 12 | 10 9
  • 13. Preparation | import appliance into VirtualBox You might get a warning about network interfaces when importing the VM. In this case, click “Change Network Settings” and continue. This should resolve the issue. 13 | 10 9
  • 14. Preparation | network setup Steps for all Start VM Login on CentOS ● Name/pwd  root/welcome1 Inspect the ip address of “eth0” ● [root@puppetagent1 ~]# ip addr show or ● [root@puppetagent1 ~]# ifconfig If only “lo” is listed and not “eth0” then run: ● [root@puppetagent1 ~]# ~/deleteUdevRules.sh ● [root@puppetagent1 ~]# shutdown –r now Retry Note: Press “F1” when Linux is booting to see details about what is happening. 14 | 10 9
  • 15. Preparation | network setup Steps for all (continued) Make sure that the firewall(s) on the host machines don’t block traffic between the VMs running the Puppet Master and Puppet Agents. 15 | 10 9
  • 16. Preparation | network setup Steps for Puppet Master None Steps for Puppet Agent 1 Enable lookup and ping of the Puppet Master by editing the file /etc/hosts: [root@puppetagent1 ~]# vi /etc/hosts Add a new line: 192.168.1.107 puppetmaster puppetmaster.localdomain In which you replace 192.168.1.107 with the actual IP-address of the Puppet Master Verify that you can ping the Puppet Master: [root@puppetagent1 ~]# ping puppetmaster [root@puppetagent1 ~]# ping puppetmaster.localdomain 16 | 10 9
  • 17. Preparation | network setup Steps for Puppet Agent 2 Change the VM hostname to puppetagent2 by editing the file /etc/sysconfig/network: [root@puppetagent2 ~]# vi /etc/sysconfig Change puppetagent1 to puppetagent2 Enable lookup and ping of the Puppet Master by editing the file /etc/hosts: [root@puppetagent2 ~]# vi /etc/hosts Add a new line: 192.168.1.107 puppetmaster puppetmaster.localdomain In which you replace 192.168.1.107 with the actual IP-address of the Puppet Master Verify that you can ping the Puppet Master, run: [root@puppetagent2 ~]# ping puppetmaster [root@puppetagent2 ~]# ping puppetmaster.localdomain 17 | 10 9
  • 18. Preparation | network setup Verify network settings Run the following on the Puppet Agent 1 and Puppet Agent 2: [root@puppetagent2 ~]# telnet puppetmaster 8141 or [root@puppetagent2 ~]# nmap -P0 -p 8140 puppetmaster 18 | 10 9
  • 19. Preparation | time Make sure that the VMs’ clocks are in sync Run the following command on the Master and Agents at (almost) the same time to synch the clocks: [root@puppetmaster /]# date +%T -s hh:mm:ss where hh = hours, mm = minutes, and ss = seconds, for example: [root@puppetmaster /]# date +%T -s 14:10:00 –u 19 | 10 9
  • 20. For your information | puppet agent status Puppet status By default, the Puppet Agent runs every 30 min as a background process. To have a better view of what is going on the Agent process is disabled on the VMs. [root@puppetagent1]# /etc/init.d/pe-puppet status 20 | 10 9
  • 21. For your information | directories Puppet directories Puppet Enterprise is installed in /opt/puppet Puppet configuration files, including modules and manifests, are stored in /etc/puppetlabs/puppet 21 | 10 9
  • 22. Installing Puppet Confirm installation by retrieving Puppet version [root@puppetagent1]# puppet --version 22 | 10 9
  • 23. Installing Puppet Confirm installation by retrieving facts of the system [root@puppetagent1]# facter 23 | 10 9
  • 24. Inspect the Puppet Console and create users 1. Open browser and navigate to https://[puppetmaster] where [puppetmaster] is the IP-address or server name of the server where the Puppet Master runs 2. Login using master@ukoug.org/welcome1 3. Inspect the Puppet Console 4. Add users agent1@ukoug.org and agent2@ukoug.org (both with password welcome1 and admin role) by navigating to master (dropdown in top-right corner)  Admin Tools 24 | 10 9
  • 25. Inspect the Puppet Console | login 25 | 10 9
  • 26. Inspect the Puppet Console | homepage 26 | 10 9
  • 27. Inspect the Puppet Console | add users 27 | 10 9
  • 28. Inspect the Puppet Console | user activation Click activation link per new user (link may need rewriting) 28 | 10 9
  • 29. Inspect the Puppet Console | user activation 29 | 10 9
  • 30. Inspect the Puppet Console | user activation 30 | 10 9
  • 31. Labs PUPPET HELLO WORLD 31 | 10 9
  • 32. Puppet Hello World Summary Create your first Puppet Manifest and run it locally (serverless Puppet) Enlist the Puppet Agent with the Puppet Master and run the Manifest in a Master/Agent setup 32 | 10 9
  • 33. Puppet Hello World | create your first manifest Create top-level manifest directory for Puppet in /home/puppet/manifests [root@puppetmaster /]# cd /home [root@puppetmaster home]# mkdir puppet [root@puppetmaster home]# cd puppet/ [root@puppetmaster puppet]# mkdir manifests [root@puppetmaster puppet]# cd manifests/ 33 | 10 9
  • 34. Puppet Hello World | create your first manifest Create site.pp manifest [root@puppetmaster manifests]# vi site.pp file { '/tmp/puppetdemo': ensure => directory, } file { '/tmp/puppetdemo/helloworld.txt': content => 'Hello World Puppet!', require => File['/tmp/puppetdemo'], } 34 | 10 9
  • 35. Puppet Hello World | create your first manifest Validate site.pp manifest [root@puppetmaster manifests]# puppet parser validate site.pp 35 | 10 9
  • 36. Puppet Hello World | create your first manifest Simulate run of site.pp manifest [root@puppetmaster manifests]# puppet apply site.pp --noop Indicates that two file resources are absent and would be created 36 | 10 9
  • 37. Puppet Hello World | create your first manifest Run site.pp manifest [root@puppetmaster manifests]# puppet apply site.pp 37 | 10 9
  • 38. Puppet Hello World | create your first manifest Verify that file is created [root@puppetmaster manifests]# cat /tmp/puppetdemo/helloworld.txt 38 | 10 9
  • 39. Puppet Hello World | create your first manifest Rerun site.pp manifest [root@puppetmaster manifests]# puppet apply site.pp No changes applied, system is in desired state 39 | 10 9
  • 40. Puppet Hello World | create your first manifest Edit /tmp/puppetdemo/helloworld.txt and rerun manifest [root@puppetmaster manifests]# vi /tmp/puppetdemo/helloworld.txt 40 | 10 9
  • 41. Puppet Hello World | create your first manifest Edit /tmp/puppetdemo/helloworld.txt and rerun manifest [root@puppetmaster manifests]# puppet apply site.pp One change applied, only file contents are changed by Puppet 41 | 10 9
  • 42. Puppet Hello World | enlisting agents Trigger enlistment of Agent to Master by running the puppet agent command on agent1 and agent2: [root@puppetagent1 ~]# puppet agent --test 42 | 10 9
  • 43. Puppet Hello World | enlisting agents Console  Node Requests (2)  Pending node requests (2) 43 | 10 9
  • 44. Puppet Hello World | enlisting agents Accept requests  Accept All 44 | 10 9
  • 45. Puppet Agent | rerun Hello World as Agent Rerun puppet agent --test on the Puppet Agents and Master to retrieve required Puppet configuration (after this steps the nodes are listed in the Console) 45 | 10 9
  • 46. Puppet Hello World | enlisting agents Nodes are enlisted 46 | 10 9
  • 47. Puppet Agent | rerun Hello World as Agent Delete /tmp/puppetdemo on both Puppet Agents and Master  [root@puppetagent1 ~]# rm -rf /tmp/puppetdemo/ Edit the Puppet Master site.pp manifest  [root@puppetmaster ~]# vi /etc/puppetlabs/puppet/manifests/site.pp Add the two file resources to the site.pp file (just above the node declaration) that we added earlier to the local site.pp  file { '/tmp/puppetdemo': ensure => directory, } file { '/tmp/puppetdemo/helloworld.txt': content => 'Hello World Puppet!', require => File['/tmp/puppetdemo'], } 47 | 10 9
  • 48. Puppet Agent | rerun Hello World as Agent Run from Console: Live Management  Control Puppet  Runonce  Run 48 | 10 9
  • 49. Puppet Agent | inspect the state and changes in Console Nodes  All  select node 49 | 10 9
  • 50. Puppet Agent | inspect the state and changes in Console Nodes  All  select node  Select latest report 50 | 10 9
  • 51. Puppet Agent | compare resources of nodes in Console Live Management  Browse Resources  Inspect All 51 | 10 9
  • 52. Labs PROVISIONING JDK 7 52 | 10 9
  • 53. Provision JDK 7 on VMs using Puppet Summary Inspect the directories and files in the module “java” Create the module “java” on Puppet Master with an init.pp manifest for installing JDK 7 Include the “java” class in the Puppet Master site.pp manifest and declare it to have it applied Trigger a run on the Puppet Agents and Puppet Master Verify JDK 7 installation Inspect Puppet Console 53 | 10 9
  • 54. Provision JDK 7 on VMs using Puppet Preparation Puppet Agents normally retrieve binaries (and other large files) from a central location such as yum, Puppet Master, artifact repository, etc. To avoid overloading of the SuperSunday network though we need to copy the jdk-7u45-linux-i586.tar.gz locally. Copy the JDK file from your local machine (host) to the /software directory of the VM (guest). You can use WinSCP for this. See the following section in this presentation: “Running WinSCP on Windows to copy and move files to and from VM”. 54 | 10 9
  • 55. Inspect “java” module Unpack the java module [root@puppetmaster /]# cd /software/ [root@puppetmaster /]# unzip puppetJavaModule.zip Grant execute rights on the scripts that will be used [root@puppetmaster /]# chmod -R a=rwx /software/puppetJavaModule/java/files/scripts/*.* Inspect the directory structure Directory Description java Root directory of the Puppet “java” module. A module is a self-contained bundle of code and data. java/manifests Directory containing the resource declarations (Puppet code) for this module. The file init.pp is mandatory. java/files Directory containing the files (scripts, binaries, etc.) that are needed by this module. java/files/scripts Subdirectory containing scripts from the silent install lab that will be used to install JDK 7 using Puppet. java/files/software Subdirectory that will contain the JDK 7 binary. java/lib Directory containing plugins for the module. java/lib/facter Subdirectory that contains a custom fact (in Ruby) that determines if JDK 7 has been installed or not. 55 | 10 9
  • 56. Inspect “java” module Inspect the java_directory_exists.rb file in the java/lib/facter directory This file contains a (simplified) Ruby script that checks if JDK 7 has been installed. This is done by checking the existence of the /u01/app/oracle/product/jdk1.7.0_45 directory. The result will be stored in the custom fact “java_directory_exists”. We don’t want Puppet to reinstall JDK 7 everytime the Puppet Agent runs. We need a way to let Puppet know that JDK 7 has been installed using a fact. Inspect the init.pp file in the java/manifests directory This file contains the manifest (Puppet code or system declaration) for installing JDK 7. It will check the “java_directory_exists” fact to determine if JDK 7 needs to be installed. If not, it will create the necessary directories, copy the required files to the Puppet Agent (remember, the Puppet Master can also act as Puppet Agent), and then executes the silent install scripts we saw earlier to install JDK 7. 56 | 10 9
  • 57. Create “java” module on Puppet Master Create “java” module directory on Puppet Master [root@puppetmaster /]# mkdir /etc/puppetlabs/puppet/modules/java Copy module files from /software directory on Puppet Master [root@puppetmaster /]# cp -r /software/puppetJavaModule/java/* /etc/puppetlabs/puppet/modules/java/ 57 | 10 9
  • 58. Include “java” class in site.pp manifest Edit the site.pp file on Puppet Master [root@puppetmaster /]# vi /etc/puppetlabs/puppet/manifests/site.pp Replace the node declaration (“node default {...}”) with the following: node 'puppetmaster', 'puppetagent1', 'puppetagent2' { include java } This will apply the Java class (JDK 7 installation) to the puppetmaster, puppetagent1, and puppetagent2 nodes. 58 | 10 9
  • 59. Trigger a run on the Puppet Master and Agents [root@puppetmaster /]# puppet agent --test [root@puppetagent1 /]# puppet agent --test [root@puppetagent2 /]# puppet agent --test 59 | 10 9
  • 60. Verify JDK 7 installation [root@puppetmaster /]# cd /u01/app/oracle/product/jdk1.7.0_45/bin [root@puppetmaster /]# ./java -version [root@puppetagent1 /]# ./java -version [root@puppetagent2 /]# ./java -version 60 | 10 9
  • 61. Inspect Puppet Console | node reports Nodes  Changed  puppetagent2 61 | 10 9
  • 62. Inspect Puppet Console | node reports Nodes  Changed  puppetagent2  select report 62 | 10 9
  • 63. Removing JDK 7 Rerun the Puppet Agent command; Puppet knows that JDK 7 has been installed and won’t perform any actions If you want to reinstall JDK 7 using Puppet then remove JDK 7 by deleting the JDK directory [root@puppetmaster /]# rm -rf /u01/app/oracle/product/jdk1.7.0_45 Or run /software/java/scripts/rollback.sh to delete all Oracle software 63 | 10 9
  • 64. Labs PROVISIONING WLS 12C 64 | 10 9
  • 65. Provision WLS 12c on VMs using Puppet Summary Inspect the directories and files in the module “weblogic” Create the module “weblogic” on Puppet Master with an init.pp manifest for installing WebLogic Server 12c Include the “weblogic” class in the Puppet Master site.pp manifest and declare it to have it applied Trigger a run on the Puppet Agents and Puppet Master Verify WebLogic 12c installation Inspect Puppet Console 65 | 10 9
  • 66. Provision WLS 12c on VMs using Puppet Preparation Puppet Agents normally retrieve binaries (and other large files) from a central location such as yum, Puppet Master, artifact repository, etc. To avoid overloading of the SuperSunday network though we need to copy the wls_121200.jar locally. Copy the WLS file from your local machine (host) to the /software directory of the VM (guest). You can use WinSCP for this. See the following section in this presentation: “Running WinSCP on Windows to copy and move files to and from VM”. 66 | 10 9
  • 67. Inspect “weblogic” module Unpack the java module [root@puppetmaster /]# cd /software/ [root@puppetmaster /]# unzip puppetWeblogicModule.zip Grant execute rights on the scripts that will be used [root@puppetmaster /]# chmod -R a=rwx /software/puppetWeblogicModule/weblogic/files/scripts/*.* Inspect the directory structure Directory Description weblogic Root directory of the Puppet “weblogic” module. A module is a self-contained bundle of code and data. weblogic/manifests Directory containing the resource declarations for this module. The file init.pp is mandatory. weblogic/files Directory containing the files (scripts, binaries, etc.) that are needed by this module. weblogic/files/scripts Subdirectory containing scripts from the silent install lab that will be used to install WLS using Puppet. weblogic/files/software Subdirectory that will contain the WLS binary. weblogic/lib Directory containing plugins for the module. weblogic/lib/facter Subdirectory that contains a custom fact (in Ruby) that determines if WLS 12c has been installed or not. 67 | 10 9
  • 68. Inspect “weblogic” module Inspect the rb files in the weblogic/lib/facter directory This directory contains (simplified) Ruby scripts that check if WebLogic Server has been installed and the domain directory has been created. This is done by checking the existence of certain directories. The result will be stored in the custom facts “weblogic_server_directory_exists” and “weblogic_domain_directory_exists”. We don’t want Puppet to reinstall WLS 12c everytime the Puppet Agent runs. We need a way to let Puppet know that WLS 12c has been installed using a fact. Inspect the init.pp file in the weblogic/manifests directory This file contains the manifest (Puppet code or system declaration) for installing WLS 12c. It will check the “weblogic_server_directory_exists” fact to determine if WLS 12c needs to be installed. If not, it will create the necessary directories, copy the required files to the Puppet Agent (remember, the Puppet Master can also act as Puppet Agent), and then executes the silent install scripts we saw earlier to install WLS 12c and create the domain. 68 | 10 9
  • 69. Create “weblogic” module on Puppet Master Create “weblogic” module directory on Puppet Master [root@puppetmaster /]# mkdir /etc/puppetlabs/puppet/modules/weblogic Copy module files from /software directory on Puppet Master [root@puppetmaster /]# cp -r /software/puppetWeblogicModule/weblogic/* /etc/puppetlabs/puppet/modules/weblogic/ 69 | 10 9
  • 70. Include “weblogic” class in site.pp manifest Edit the site.pp file on Puppet Master [root@puppetmaster /]# vi /etc/puppetlabs/puppet/manifests/site.pp Expand the node declaration with the following: node 'puppetmaster', 'puppetagent1', 'puppetagent2' { include java include weblogic Class['java'] -> Class['weblogic'] } This will apply the “java” and “weblogic” class to the puppetmaster, puppetagent1, and puppetagent2 nodes. The “weblogic” class is dependent on the “java” class. 70 | 10 9
  • 71. Trigger a run on the Puppet Master and Agents [root@puppetmaster /]# puppet agent --test [root@puppetagent1 /]# puppet agent --test [root@puppetagent2 /]# puppet agent --test The output of the install server and create domain scripts is only displayed after the installation, so be patient when running the agent  71 | 10 9
  • 72. Verify WebLogic 12c installation Inspect the WLS 12c directories in /u01/app/oracle. Manually perform the steps from WebLogic Hackathon WebLogic Server Installation and Automation.pdf beginning from “Start the Node Manager”. This should result in an up-and-running WebLogic Server. You can check the WebLogic Console. 72 | 10 9
  • 73. Inspect Puppet Console | node reports Nodes  Changed  puppetagent1 73 | 10 9
  • 74. Inspect Puppet Console | node reports Nodes  Changed  puppetagent1  select report 74 | 10 9
  • 75. Removing WLS 12c Rerun the Puppet Agent command; Puppet knows that WLS 12c has been installed and won’t perform any actions If you want to reinstall WLS 12c using Puppet then remove WLS 12c by running the rollback script. Note: this will also remove JDK 7. [root@puppetmaster /]# /software/weblogic/scripts/rollback.sh 75 | 10 9
  • 76. Verify install after remainder of steps Open the Oracle WebLogic Server 12c Console 76 | 10 9
  • 77. Labs BONUS (1): REWRITE JAVA & WEBLOGIC MODULES 77 | 10 9
  • 78. Rewrite “java” and “weblogic” modules Objective In the previous two labs we have reused the silent install scripts in the Puppet modules “java” and “weblogic”. This way Puppet was used as a wrapper that manages these scripts. The commands in these scripts also manage and alter resources (files, directories, executions, etc.) that can also be directly managed by Puppet. Translate the commands in the scripts to Puppet resource types so we won’t be executing a bunch of specific scripts any more. This way, we can run the modules on more platforms and operating systems and parameterize the modules. 78 | 10 9
  • 79. Labs BONUS (2): EXPAND WEBLOGIC MODULE 79 | 10 9
  • 80. Expand “weblogic” module Objective Expand the “weblogic” module so that it will: ● install WLS 12c and create a WLS domain when nothing is installed yet; ● only create a WLS domain when WLS 12c is installed, but no domain has been created yet. Expand the “weblogic” module so that the Node Manager, the Admin Server, and Managed Server are started automatically by Puppet 80 | 10 9
  • 81. References RUNNING PUTTY 81 | 10 9
  • 82. Running PuTTY | know SSH port to connect to VM PuTTY connects to VM on the SSH port. The default SSH port is 22. Exception: when using NAT with port forwarding enabled you can assign a different port that redirects to the SSH port of the VM. 82 | 10 9
  • 83. Running PuTTY | start VM 83 | 10 9
  • 84. Running PuTTY | connect to VM using PuTTY 84 | 10 9
  • 85. Running PuTTY | edit file 85 | 10 9
  • 86. References RUNNING WINSCP 86 | 10 9
  • 87. Running WinSCP| know SSH port to connect to VM WinSCP connects to VM on the SSH port. The default SSH port is 22. Exception: when using NAT with port forwarding enabled you can assign a different port that redirects to the SSH port of the VM. 87 | 10 9
  • 88. Running WinSCP | start VM 88 | 10 9
  • 89. Running WinSCP| connect to VM using WinSCP 89 | 10 9
  • 90. References PUPPET MASTER INSTALLATION 90 | 10 9
  • 91. Installing Puppet Master 91 | 10 9
  • 92. Installing Puppet Master 92 | 10 9
  • 93. Installing Puppet Master 93 | 10 9
  • 94. Installing Puppet Master 94 | 10 9
  • 95. Installing Puppet Master 95 | 10 9
  • 96. Installing Puppet Master 96 | 10 9
  • 97. Installing Puppet Master 97 | 10 9
  • 98. Installing Puppet Master 98 | 10 9
  • 99. Installing Puppet Master 99 | 10 9
  • 100. Installing Puppet Master 100 | 9 10
  • 101. Installing Puppet Master 101 | 9 10
  • 102. Installing Puppet Master 102 | 9 10
  • 103. Installing Puppet Master 103 | 9 10
  • 104. Installing Puppet Master 104 | 9 10
  • 105. Installing Puppet Master 105 | 9 10
  • 106. Installing Puppet | install puppet-lint Install Puppet Lint (optional) for manifest checking 106 | 9 10
  • 107. Installing Puppet Master | verify by opening dashboard Dashboard runs on https://localhost 107 (default port 443, mind port number if using NAT and port forwarding for VM) | 9 10
  • 108. Installing Puppet Master | verify by opening dashboard 108 | 9 10
  • 109. References PUPPET AGENT INSTALLATION 109 | 9 10
  • 110. Installing Puppet Agent Puppet Enterprise is already installed on the Puppet Master and Puppet Agents. The Puppet Enterprise software is present on the VMs in the directory /software. Log into the Puppet Agent VM and run: [root@puppetagent1 software]# tar -xzf puppet-enterprise-3.1.0-el-6i386.tar.gz [root@puppetagent1 software]# cd puppet-enterprise-3.1.0-el-6-i386/ [root@puppetagent1 puppet-enterprise-3.1.0-el-6-i386]# ./puppetenterprise-installer 110 | 9 10
  • 111. Installing Puppet Agent 111 | 9 10
  • 112. Installing Puppet Agent 112 | 9 10
  • 113. Installing Puppet Agent 113 | 9 10
  • 114. Installing Puppet Agent 114 | 9 10
  • 115. Installing Puppet Agent 115 | 9 10
  • 116. Installing Puppet Agent 116 | 9 10
  • 117. Installing Puppet Agent 117 | 9 10
  • 118. Installing Puppet Agent 118 | 9 10
  • 119. Installing Puppet Agent 119 | 9 10
  • 120. Installing Puppet Agent 120 | 9 10
  • 121. Installing Puppet Agent 121 | 9 10
  • 122. Installing Puppet Agent 122 | 9 10
  • 123. Installing Puppet | install puppet-lint Install Puppet Lint (optional) for manifest checking 123 | 9 10
  • 124. References USEFUL PUPPET COMMANDS & LINKS 124 | 9 10
  • 125. Puppet commands Inspect Puppet version puppet --version Run Puppet locally and apply manifest puppet apply xyz.pp Run Puppet locally and apply manifest with debug output puppet apply xyz.pp –debug Run Puppet locally and apply manifest with summary puppet apply xyz.pp --summarize Dry-run Puppet locally and simulate applying manifest puppet apply xyz.pp –noop Validate manifest syntax puppet parser validate xyz.pp 125 | 9 10
  • 126. Puppet commands Retrieve all node facts using Puppet facter Retrieve single fact using Puppet facter [fact], for example: facter processorcount List all known resource types puppet describe -l Describe (the use of) a specific resource type puppet describe [type], for example puppet describe user Inspect state of all resources of a specific type puppet resource [type], for example: puppet resource user Inspect state of a specific resources puppet resource [type] [name], for example: puppet resource user root 126 | 9 10
  • 127. Puppet commands Trigger single Puppet Agent run (retrieves manifests from Puppet Master and applies them) puppet agent Trigger single Puppet Agent run with verbose output puppet agent --test Find Puppet Module in the Puppet Forge puppet module search [module], for example: puppet module search oracle Install Puppet Module from the Puppet Forge puppet module install [module], for example: puppet module install puppetlabs-motd puppet module install puppetlabs-motd Add debug line to manifest using notify resource type notify {“My debug statement”:} 127 | 9 10
  • 128. Links | Puppet Type Reference http://docs.puppetlabs.com/references/latest/type.html 128 | 9 10
  • 129. Links | Puppet Language Reference http://docs.puppetlabs.com/puppet/3/reference/lang_summary.html 129 | 9 10
  • 130. Links | Puppet Style Guidelines http://docs.puppetlabs.com/guides/style_guide.html 130 | 9 10
  • 131. Other | puppet-lint to check style guidelines [root@puppetmaster ~]# sudo gem install puppet-lint [root@puppetmaster ~]# puppet-lint xyz.pp 131 | 9 10
  • 132. Thank you! Ronald van Luttikhuizen Ronald.van.Luttikhuizen@oboxproducts.com 132 | 9 10