Not a customer? Click the 'Start a free trial' link to begin a 30-day SaaS trial of our product and to join our community.
Existing Cisco AppDynamics customers should click the 'Sign In' button to authenticate to access the community
on 09-10-2024 02:19 PM
This article will guide you through installing the AppDynamics Smart Agent on a Linux system using Ansible. It covers downloading, configuring, and starting the Smart Agent in an automated fashion. This setup ensures that the Smart Agent is correctly configured for your environment.
sudo
(root) privileges to execute tasks.
Create a directory structure for the Ansible playbook as follows:
Define your target machine (localhost in this case) in the inventory
file:
[appd_agents]
localhost ansible_connection=local
playbook.yml
)The main playbook references the smart_agent
role. Ensure become: true
is set to allow privilege escalation for necessary tasks:
---
- hosts: appd_agents
become: true
roles:
- smart_agent
roles/smart_agent/tasks/main.yml
)The tasks in this role will include downloading, unarchiving, configuring, and starting the Smart Agent.
- name: Download AppDynamics Smart Agent using curl
command: >
curl -L -O -H "Authorization: Bearer <YOUR_AUTH_TOKEN>"
"https://download.appdynamics.com/download/prox/download-file/appdsmartagent/<version>/appdsmartagent_64_linux_<version>.zip"
args:
chdir: /tmp
- name: Unarchive the Smart Agent zip
unarchive:
src: /tmp/appdsmartagent_64_linux_<version>.zip
dest: /opt/appdynamics/
remote_src: yes
- name: Configure Smart Agent in config.ini
replace:
path: /opt/appdynamics/config.ini
regexp: 'ControllerURL\s*=\s*.*'
replace: 'ControllerURL=https://xxxxx.saas.appdynamics.com'
- name: Set ControllerPort in config.ini
replace:
path: /opt/appdynamics/config.ini
regexp: 'ControllerPort\s*=\s*.*'
replace: 'ControllerPort=443'
- name: Set FMServicePort in config.ini
replace:
path: /opt/appdynamics/config.ini
regexp: 'FMServicePort\s*=\s*.*'
replace: 'FMServicePort=443'
- name: Set AccountAccessKey in config.ini
replace:
path: /opt/appdynamics/config.ini
regexp: '^AccountAccessKey\s*=\s*.*'
replace: 'AccountAccessKey=<YOUR_ACCOUNT_ACCESS_KEY>'
- name: Ensure AccountName is set in the main section of config.ini
lineinfile:
path: /opt/appdynamics/config.ini
regexp: '^AccountName\s*='
line: 'AccountName=xxxxx'
insertafter: '^ControllerPort\s*=.*'
- name: Enable SSL in config.ini
replace:
path: /opt/appdynamics/config.ini
regexp: 'EnableSSL\s*=\s*.*'
replace: 'EnableSSL=true'
- name: Start Smart Agent
shell: /opt/appdynamics/smartagentctl start --service > /tmp/log.log 2>&1
become: yes
register: output
Replace the download URL placeholder with your own Smart Agent download URL from the AppDynamics download site.
command
task for downloading the Smart Agent, replace <YOUR_AUTH_TOKEN>
with your AppDynamics authentication token and replace <version>
with the appropriate version for your Smart Agent. For example:- name: Download AppDynamics Smart Agent using curl
command: >
curl -L -O -H "Authorization: Bearer YOUR_AUTH_TOKEN"
"https://download.appdynamics.com/download/prox/download-file/appdsmartagent/24.8.0.551/appdsmartagent_64_linux_24.8.0.551.zip"
args:
chdir: /tmp
To run the playbook, execute the following command:
ansible-playbook -i inventory playbook.yml
This Ansible playbook simplifies downloading, configuring, and running the AppDynamics Smart Agent on a Linux system. Make sure to replace the download URL and account details with your specific values, and you’ll have the agent up and running in no time.
Thank you! Your submission has been received!
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form