PDF
Download PDF
Download page Ansible Configuration for Python Agent.
Ansible Configuration for Python Agent
The following sections provide the example use cases for the Python Agent Playbook:
Install Python Agent
Example 1: AnsibleĀ® role used to install Python Agent with the following features:
- Installs Python Agent on Linux (Debian, Alpine, and RedHat)
- Creates a backup if existing installation is detected
---
- hosts: all
tasks:
- name: Include variables for the controller settings
# Include all yaml files under the vars directory
include_vars:
dir: vars
extensions:
- 'yaml'
- 'yml'
- include_role:
name: appdynamics.agents.python
vars:
agent_version: 22.10.0.5500.0
# possible value:
# - latest: Latest version
# - 22.10.0.5500.0: Any Specific version number
agent_type: python
agent_action: upgrade
# possible value:
# - upgrade: upgrade currently installed agent to agent_version
# - install: install agent_version
# - rollback: rollback to previous backup if any
# - uninstall: uninstall agent
# Python specific Args
install_env: default # [default - (main python path taken automatically), virtualenv - (virtualenv path need to be provided)]
# possible value:
# - default: install agent in global python
# - virtualenv: install agent to specific virtualenv
virtualenv_path: /home/ansible/venv
# possible value:
# - /home/ansible/venv: virtualenv path
# - None
install_agent_from: appd-portal
# possible value:
# - pypi: Downlaod agent from PYPI
# - appd-portal: Download agent from AppD portal
YML
Example 2: Ansible role to start a sample application with Python Agent:
---
- hosts: all
tasks:
- name: Include variables for the controller settings
# Include all yaml files under the vars directory
include_vars:
dir: vars
extensions:
- 'yaml'
- 'yml'
- include_role:
name: appdynamics.agents.python
- name: Start Sample Python app
shell: "nohup pyagent run -c /opt/appdynamics/python-agent/appd.cfg python3 /home/ubuntu/app.py &"
async: 100
poll: 0
register: status
failed_when: "'FAILED' in status.stdout"
Config path and the application path has to be changed accordingly.
YML
Python Agent Variables
Variable | Description | Default | Possible Values | Required |
---|---|---|---|---|
| Specify the absolute path (including the file path) for the manually created configuration file containing the agent configuration data. | None. | agent_destination_directory | No |
analytics_host | Analytics Agent hostname. | localhost | No | |
analytics_port | Analytics Agent port. | 9090 | No | |
analytics_ssl | Set to ON to enable SSL communication with the Analytics Agent. | OFF | No | |
analytics_ca_file | Certificate of the CA authority that signed the certificate of Analytics Agent. | No | ||
eum_disable_cookie | When set to ON , the agent does not add EUM correlation data to WSGI response headers. | OFF | OFF, ON | No |
eum_user_agent_allowlist | If specified overwrites the default allowlist for user agents added as EUM correlation data headers. Use it to specify alternate user agents as a comma-separated list. Use '*' to allow all user agents. | Mozilla, Opera, WebKit, Nokia | No | |
install_agent_from | Install Agent from PYPI or Download portal | pypi | pypi, appd-portal | Yes |
install_env | Python Environment where to install Splunk AppDynamics Agent (global or virtual environment) | default | default, virtualenv | Yes |
log_level | Directory to write proxy and agent logs | warning | warning, debug, info | No |
log_debugging | The log level for the agent. | off, on | No | |
log_dir | Directory to write debug level logs | /tmp/appd/logs | No | |
node_reuse | Reuse node names | - | true , false | No |
node_reuse_prefix | Node name prefix while reusing node names | - | - | No |
pypi_index_url | Change the pypi index url to any internal artifactory | https://pypi.org/simple | No | |
snapshot_exit_call_details_length | Specifies the number of characters in the details string describing exit calls in transaction snapshots. | 100 | No | |
transaction_monitor_bt_max_duration_ms | The maximum duration of a business transaction in milliseconds. | 12000 | No | |
virtualenv_path | Path to virtualenv . It is required if install_env is set to virtualenv | none | None, | Yes, if install_env = virtualenv No, if install_env = default |
wsgi_script | Path to WSGI script file. | No | ||
wsgi_callable | Name of WSGI callable in script/module. | application | No | |
wsgi_module | The fully-qualified name of the application module. | No |
AnsibleĀ® is a registered trademark of Red Hat, Inc. in the United States and other countries.