Introduction
Using Ansible Playbooks for the bulk deployment of Oracle Management Agents offers several benefits, including resource optimization by minimizing the time and effort needed to install agents on multiple hosts. The process provides a unified, single setup for all hosts, making the deployment more efficient and consistent. Additionally, centralized management is enabled, allowing all installations to be controlled from one controller host, streamlining oversight and coordination. In addition, the installation key is automatically generated within the Ansible playbook script, simplifying and automating the deployment process even more.
Some terminology used in this tutorial:
- Management Agent (Agent): Collects data from the host where it is installed and sends it to Oracle Cloud Infrastructure's Observability and Management services.
- Management Agent Cloud Service (MACS): Manages Management Agents and their lifecycle, enabling Oracle Cloud services to interact and collect data.
- Agent Install Key: Issued against your identity domain and validates the authenticity of the installation.
Objectives
This tutorial provides the details of setting up and executing playbooks for installing management agents across multiple hosts from a single controller host.
Prerequisites
-
Ansible installation: Ensure Ansible (version 2.9 or above) is installed on the controller host.
For details, see the Ansible Installation Guide. -
Python installation: Ensure Python3 (version 3.6 or above) is installed on all target and controller hosts.
Refer to the Python Installation Guide. - SSH capability: Ensure SSH access to all target hosts; user should be able to become root.
-
OCI CLI installation: Install OCI CLI and create the OCI configuration on the controller host.
For details, see: -
Ansible collection: Ensure the Ansible collection is configured with OCI CLI on the controller host.
For details, see Getting Started with Ansible Collection.
Task 1: Configure the playbooks
-
Clone the Git Repository:
git clone https://github.com/oracle-quickstart/oci-management-agent.git
-
Navigate to the Playbooks directory:
cd deployment/ansible-playbooks
-
Edit the Ansible inventory file, the "hosts" file, with the following:
- target_hosts: Specifies where to install the agents.
- target_hosts:vars: Target host-specific variables.
- all:vars: Global variables for all hosts, including the controller host.
Here is what the file may look like:
Description of the illustration ansible.png -
Set the environment variable compartment_ocid on on controller host. This value represents the compartment for the management agent:
export compartment_ocid=your comportament OCID
where the OCID is of the format similar to:ocid1.compartment.oc1.aaaaaa............xxxxxxx
Task 2: Perform the installation
-
Run the following on the controller host:
ansible-playbook -i hosts mgmt_agent_install.yaml -kK
Note: The-kK
option, which stands for--ask-pass
and-ask-become-pass
, prompts for both the SSH user password and the password to become root (defaults to SSH password).
Task 3: Verify the installation
- First, check the output of the installation to confirm a successful installation. It should look similar to the following:
Description of the illustration verify_install.png -
Log in to Oracle Cloud and:
- Navigate to Observability & Management, click Management Agents and then Agents.
- Select your compartment and verify the agents are installed on your target hosts.
Description of the illustration agent.png
Acknowledgements
- Authors - Sandeep Kumar (O&M Principal Product Manager), Goutham V (O&M Software Engineer), Madhavan Arnisethangaraj (O&M Principal Member Technical Staff)
- Contributors - Daniela Hansell (O&M Director)
More Learning Resources
Oracle Management Agent bulk deployment using Ansible Playbooks
G37059-01
July 2025
Copyright © 2025, Oracle and/or its affiliates.