Oracle Linux Virtualization Manager coupled with Oracle Enterprise Manager is a powerful combination. Based upon the open source oVirt project, Oracle Linux Virtualization Manager is a server virtualization management platform that can be easily deployed to configure, monitor, and manage an Oracle Linux kernel-based Virtual Machine (KVM) environment. Oracle Enterprise Manager is a complete, integrated, and business-driven enterprise cloud management solution. Oracle Enterprise Manager 13c is the recommended management framework for managing Oracle Infrastructure Software and Oracle Engineered Systems. The first step for inclusion within the Oracle Enterprise Manager framework is the installation of the Oracle Enterprise Manager agent. Once the agent is installed a host target is created which then enables higher level monitoring.
This post will discuss how to automate this installation of the Oracle Enterprise Manager agent as part of the Virtual Machine provisioning process using tools within Oracle Enterprise Manager and Oracle Linux Virtualization Manager.
Using Oracle Linux Virtualization Manager create an Oracle Linux 7 host based upon the latest update ISO. A useful set of video's is available here, review the Creating a Virtual Machine in Oracle Linux Virtualization and Uploading Resources to a Data Storage Domain with Oracle Linux Virtualization Manager video's.
Once the Oracle Linux 7 host is created, install and configure the host to enable the Oracle Enterprise Manager agent install via the AgentPull script method. Documentation on this method is here.
Create an Oracle Linux Virtualization Manager template from the newly created and prepared Oracle Linux 7 host. Using the video portal above, review the Creating a Template from a Virtual Machine in Oracle Linux Virtualization Manager video.
Create a new host based upon the newly created template which is ready to have the Oracle Enterprise Manager agent automatically installed. Using the video portal above, review the Creating a Virtual Machine from a template in Oracle Linux Virtualization Manager video.
Within the lab I have the following:
Oracle Enterprise Manager 13c version 13.4
Oracle Linux Virtualization Manager version 4.3.6 with a single KVM host
Access to an Oracle Linux 7 x86-64 latest ISO
During the install of Oracle Linux 7 using a minimal install, configuring DHCP networking and accepting all the defaults, I created a user (oma, which I use often and for me stands for Oracle Management Agent) with password to use for the Oracle Enterprise Manager agent install.
If a proxy server exists in your environment then an entry needs to be added to /etc/yum.conf
Once the host was installed, I carried out the following configuration steps to prepare the host for the Oracle Enterprise Manager agent install:
Using the video referenced in the High level steps section, create a VM using the template we firstly configured. To enable the automation we need to provide configuration within the Initial Run section.
The screenshot above shows the Initial Run section with our template chosen which is em-template-iso. We also need to click the box next to Use Cloud-Init/Sysprep.
Next, we fill in our hostname, set our timezone and expand the Authentication section. For us this is not needed (and is shown as blank) as we created our user for the Oracle Enterprise Manager agent install as part of the configuration process. The authentication section is very useful for creating users based on passwords or ssh keys.
Next, we click Networks and fill in the relevant areas for our target networking; my example is ipv4 with static IP details. The Oracle Enterprise Manager agent prefers a fully qualified domain name with fixed IP address rather than a DHCP address which could change.
Finally, we click to expose the Custom Script area, this area is where we can use cloud-init to drive our configuration of the Oracle Enterprise Manager agent install.
The cloud-init script below is an example which once modified to suit your local environment can be copied or typed into the Custom Script panel.
In my example below I have used "my_em_user" as the Oracle Enterprise Manager user with "my_em_password" as the login password; I have also used "my_agent_registration_password" as the Oracle Enterprise Manager Agent registration password which is set when Oracle Enterprise Manager is installed. As stated above the variables below need to be evaluated and edited to suit your local environment.
The top "#cloud-config" definition must exist at the top of the script. Within the runcmd section the correct Oracle Enterprise Manager hostname and port should be inserted, in my example I have "https://myoms.oracle.com:7803"
- content: |
- 'su - oma sh -c "curl "https://myoms.oracle.com:7803/em/install/getAgentImage" --insecure -o AgentPull.sh"'
- 'su - oma sh -c "chmod +x /home/oma/AgentPull.sh"'
- 'su - oma sh -c "/home/oma/AgentPull.sh RSPFILE_LOC=/home/oma/agent.properties"'
The write_files definition creates a response file in the oma users home directory, here I have defined a user name and password within my Oracle Enterprise Manager 13c 13.4 system, also I have defined the agent registration password as well as the platform (Linux x86-64). In my case my Oracle Enterprise Manager 13c system is based upon Oracle Linux x86-64 and therefore would have the Linux x86-64 platform agent already installed and available. If you system is not based upon Linux x86-64 then you need to refer to the documentation with regard to the extensibility framework to download the Linux x86-64 platform agent. This section creates the file and provides the correct permissions and ownership.
The runcmd definition is where commands are run upon the initial or first boot; the cloud-init and cloud-final service have to be enabled to run at boot time. Commands in this section are placed into a script which is located in /var/lib/cloud/instance/scripts/runcmd and in the event of a failure can be run separately as root to check the validity of the commands.
These commands perform the following:
Once this section is complete, click OK, the VM can now be started where the response file will be created and then used by the AgentPull.sh script for a hands off automated Oracle Enterprise Manager agent install. When all scripts have run the Host target should appear within the Oracle Enterprise Manager UI as a managed and promoted target.