Setup & Configuration
10 minutesStep 2: Prepare Your Files and Directory Structure
Create a project directory for your Ansible deployment. It should contain the following files:
Ensure you have downloaded the correct Smart Agent packages for your target environments.
Step 3: Understanding the Files
1. Inventory Files (inventory-cloud.yaml)
The inventory file lists the hosts where the Smart Agent will be deployed. Define your hosts and authentication details here.
Action: Update the ansible_host IPs and credentials with your actual lab environment details.
2. Variables File (variables.yaml)
This file contains the configuration details for the Smart Agent.
Action: Update the smart_agent section with your specific controller URL, account name, and access key.
3. Playbook (smartagent.yaml)
The playbook orchestrates the deployment of the Cisco AppDynamics Distribution of OpenTelemetry Collector. Here is a concise summary of its tasks:
- Prerequisites: Installs necessary packages (
yum-utilsfor RedHat,curl/apt-transport-httpsfor Debian). - Directory Setup: Ensures the
/opt/appdynamics/appdsmartagentdirectory exists. - Configuration:
- Checks if
config.iniexists. - Creates a default
config.iniusing values fromvariables.yamlif missing. - Updates configuration keys (AccountAccessKey, ControllerURL, etc.) using
lineinfileto ensure settings are correct.
- Checks if
- Package Management:
- Determines the correct package path based on OS family (Debian/RedHat).
- Fails if the package is missing locally.
- Copies the package to the target host’s
/tmpdirectory. - Installs the package using
dpkgoryum.
- Service Management: Restarts the
smartagentservice. - Cleanup: Removes the temporary package file.
The playbook uses when: ansible_os_family == ... conditionals to handle both RedHat and Debian systems within the same workflow.