AppDynamics Knowledge Base

Automating AppDynamics NetViz Agent Deployment with Ansible: Cross-Platform OAuth Solution

Automating AppDynamics NetViz Agent Deployment with Ansible: Cross-Platform OAuth Solution

Building Upon AppDynamics Automation

The AppDynamics Ansible Collection provides excellent automation for Java agents, Machine agents, and Database agents. To extend this automation ecosystem, I developed an Ansible solution specifically for Network Visibility (NetViz) agents that integrates seamlessly with AppDynamics’ security model.

Why NetViz Automation Matters

Network Visibility provides crucial insights for modern applications:

  • 🔍 Network-level monitoring for microservices architectures
  • 📊 Service-to-service communication mapping
  • 🗺Automatic service discovery based on network flows
  • 📈 Network performance metrics (latency, throughput, errors)
  • 🐳 Container-aware monitoring for Docker/Kubernetes environments

Manual deployment across hundreds of servers is time-consuming and error-prone. Automation is essential.

The OAuth Authentication Challenge

AppDynamics properly secures their agent binaries behind authentication. The key breakthrough was implementing OAuth authentication directly in Ansible to work with AppDynamics’ identity service.

Here’s the authentication flow I developed:

- name: Get OAuth access token
uri:
url: "https://identity.msrv.saas.appdynamics.com/v2.0/oauth/token"
method: POST
headers:
Content-Type: "application/json"
body_format: json
body:
username: "{{ vault_oauth_username }}"
password: "{{ vault_oauth_password }}"
scopes: ["download"]
register: oauth_response
no_log: true
- name: Download NetViz with OAuth token
get_url:
url: "{{ netviz_download_url }}"
dest: "/tmp/netviz-agent.deb"
headers:
Authorization: "Bearer {{ oauth_response.json.access_token }}"
checksum: "sha256:35cb07adf9a78b2b8ffaf1c37711d1a3f362d13e1165eed52464f4b90152d2d3"

Cross-Platform Architecture

The solution supports both Linux and Windows environments with platform-specific optimizations:

┌─────────────────┐ ┌──────────────────┐ ┌────────────────────┐
│ Ansible │ │ Target Servers │ │ AppDynamics │
│ Control Node │ │ │ │ Controller │
│ │ │ 🐧 Linux NetViz │ │ │
│ OAuth Auth │───▶│ 🪟 Windows NetViz│───▶│ Network Metrics │
Cross-Platform │ │ Port 3892 │ │ Service Maps │
│ Deployment │ │ Service Mgmt │ │ Dashboards │
└─────────────────┘ └──────────────────┘ └────────────────────┘

Platform-Specific Handling

The solution automatically handles platform differences:

Component Linux Windows Package DEB (3.8 MB) ZIP (27.4 MB) Path /opt/appdynamics/netviz C:\AppDynamics\NetViz Service systemd Windows Service Installation apt package manager ZIP extraction + installer

Step-by-Step Implementation

Step 1: Repository Setup

git clone https://github.com/Abhimanyu9988/appdynamics-netviz-ansible.git
cd appdynamics-netviz-ansible

Step 2: Configure Controller Settings

Create vars/controller.yaml:

# AppDynamics Controller
controller_host: "your-tenant.saas.appdynamics.com"
controller_port: "443"
controller_ssl_enabled: "true"
controller_account_name: "your-account-name"
controller_access_key: "{{ vault_controller_access_key }}"
# NetViz Configuration
netviz_version: "25.7.0.3267"
netviz_webservice_port: 3892
netviz_max_memory: "512MB"

Step 3: Secure Credential Storage

Use Ansible Vault for security:

ansible-vault create vars/vault.yaml

Add your credentials:

# AppDynamics Credentials (encrypted)
vault_oauth_username: "your-email@domain.com"
vault_oauth_password: "your-password"
vault_controller_access_key: "your-controller-access-key"

Step 4: Main Deployment Playbook

The core playbook (deploy-netviz.yml) handles the entire process:

---
- name: Deploy AppDynamics NetViz Agent
hosts: netviz_servers
become: yes

tasks:
- name: Include vault variables
include_vars: "vars/vault.yaml"
- name: Get OAuth access token
uri:
url: "https://identity.msrv.saas.appdynamics.com/v2.0/oauth/token"
method: POST
body_format: json
body:
username: "{{ vault_oauth_username }}"
password: "{{ vault_oauth_password }}"
scopes: ["download"]
register: oauth_response
delegate_to: localhost
run_once: true
no_log: true
- name: Download NetViz DEB
get_url:
url: "https://download.appdynamics.com/download/prox/download-file/netviz-deb/25.7.0.3267/appd-netviz-x64-linux-25.7.0.3267.deb"
dest: "/tmp/netviz-agent.deb"
headers:
Authorization: "Bearer {{ oauth_response.json.access_token }}"
checksum: "sha256:35cb07adf9a78b2b8ffaf1c37711d1a3f362d13e1165eed52464f4b90152d2d3"
- name: Install NetViz Agent
apt:
deb: "/tmp/netviz-agent.deb"
state: present
- name: Configure NetViz Agent
template:
src: "templates/agent_config.lua.j2"
dest: "/opt/appdynamics/netviz/conf/agent_config.lua"
owner: appdynamics
group: appdynamics
- name: Start NetViz Service
systemd:
name: appd-netviz
state: started
enabled: yes

Step 5: Configuration Template

The agent configuration template ensures consistent setup:

-- AppDynamics NetViz Agent Configuration
agent_type = "netviz"
agent_name = "{{ inventory_hostname }}_netviz_agent"
-- Controller Configuration
controller_host = "{{ controller_host }}"
controller_port = {{ controller_port }}
controller_ssl_enabled = {{ controller_ssl_enabled }}
account_name = "{{ controller_account_name }}"
access_key = "{{ controller_access_key }}"
-- Network Configuration
webservice_port = {{ netviz_webservice_port }}
webservice_ip = "0.0.0.0"
-- Performance Settings
max_memory_usage = "{{ netviz_max_memory }}"
log_level = "{{ netviz_log_level }}"

Deployment in Action

🐧 Linux Deployment

# Deploy to Linux localhost
ansible-playbook -i inventory/localhosts.yml deploy-netviz.yaml --ask-vault-pass

🪟 Windows Deployment

# Deploy to Windows localhost  
ansible-playbook -i inventory/windows-localhost.yml deploy-netviz-windows.yml --ask-vault-pass

Cross-Platform Verification

The solution includes platform-specific verification:

Linux

# Check service status
sudo systemctl status appd-netviz
# Verify network connectivity
sudo netstat -tlnp | grep 3892

Windows

# Check service status
Get-Service "AppDynamics NetViz"
# Verify network connectivity
Test-NetConnection -Port 3892

Real-World Results

In production environments across both Linux and Windows infrastructure, this automation has delivered:

Time Savings

  • Before: 15–20 minutes per server (manual installation)
  • After: 2–3 minutes for entire fleet (automated deployment)
  • Result: 90% time reduction across both platforms

Consistency

  • Before: Configuration drift between Windows and Linux environments
  • After: Identical configuration everywhere with platform-specific optimizations
  • Result: Zero configuration-related issues across mixed environments

Security

  • Before: Credentials shared via documentation across platforms
  • After: Encrypted vault with unified OAuth authentication
  • Result: Improved security posture for both Windows and Linux deployments

Cross-Platform Benefits

  • Unified workflow for mixed Windows/Linux environments
  • Consistent OAuth authentication regardless of target platform
  • Platform-optimized installations while maintaining configuration consistency

Key Benefits Achieved

One-Command Deployment: Single Ansible command deploys across entire infrastructure Secure Authentication: OAuth integration with encrypted credential storage Automatic Verification: Built-in checksum validation and service verification Production Ready: Proper user management, service configuration, and monitoring Scalable: Works for single servers or large fleet deployments

Best Practices Learned

Security

  • Always use Ansible Vault for credentials
  • Implement no_log: true for sensitive operations
  • Verify file checksums for downloaded packages

Performance

  • Use delegate_to: localhost and run_once: true for OAuth token acquisition
  • Configure appropriate memory limits based on server capacity
  • Monitor resource usage in production

Reliability

  • Include comprehensive error handling
  • Implement automatic service verification
  • Plan for network connectivity issues

Getting Started

The complete solution is available on GitHub: appdynamics-netviz-ansible

Quick start:

git clone https://github.com/Abhimanyu9988/appdynamics-netviz-ansible.git
cd appdynamics-netviz-ansible
cp vars/controller.yaml.example vars/controller.yaml
# Edit with your details
ansible-vault create vars/vault.yaml
# Add your credentials
ansible-playbook -i inventory/localhost.yml deploy-netviz.yml --ask-vault-pass

Conclusion

This OAuth-powered, cross-platform Ansible solution transforms NetViz deployment from a manual, time-consuming process into a unified one-command operation for both Linux and Windows environments. By building upon AppDynamics’ security model and integrating with their identity service, we achieve automation, security, and platform flexibility.

The solution demonstrates how to extend excellent existing automation ecosystems while respecting security boundaries, maintaining production-ready standards, and supporting diverse infrastructure environments.

Network visibility is crucial for modern applications, and with proper cross-platform automation, it integrates seamlessly into your existing AppDynamics monitoring strategy regardless of your infrastructure mix.

Platform Support: 🐧 Linux (Ubuntu/Debian) | 🪟 Windows (Server 2016+/Windows 10+)

Version history
Last update:
‎08-21-2025 01:09 PM
Updated by:
Contributors