The following sections provide the example use cases for the PHP Agent Ansible Role:

Example 1: The following is an example of AnsibleĀ® role to install PHP Agent on Linux:

---
- hosts: all
  tasks:
    - include_role:
        name: appdynamics.agents.php
      vars:
        agent_version: latest
        agent_type: php
        agent_action: upgrade 
        application_name: e-commerce 
        controller_account_access_key: "123key" 
        controller_host_name: "fieldlab.saas.appdynamics.com" 
        controller_account_name: "customer1"
        enable_ssl: false
        controller_port: 8090
        tier_name: tier1 
        node_name: node1 
        log_directory: "/opt/appdynamics/php-agent/ecommerce_logs" 
        zts_support: false 
        
        # proxy configs
        proxy_host: master.ecommerce-proxy.com 
        proxy_port: 8080
        proxy_user: ecommerce-user 
        proxy_password_file: /etc/ecommerce/passwd
        proxy_ctrl_dir: /ecommerce/proxy_dir/
YML

Example 2: The following is an example of Ansible role to upgrade PHP Agent on Linux where agent is already installed:

---
- hosts: all
  tasks:
    - include_role:
        name: appdynamics.agents.php
      vars:
        agent_version: latest
        agent_type: php
        agent_action: upgrade 
        application_name: e-commerce 
        controller_account_access_key: "123key" 
        controller_host_name: "fieldlab.saas.appdynamics.com" 
        controller_account_name: "customer1"
        enable_ssl: false
        controller_port: 8090
        tier_name: tier1 
        node_name: node1 
        log_directory: "/opt/appdynamics/php-agent/ecommerce_logs" 
        zts_support: false 
        linux_custom_agent_install_path: "/home/ubuntu/ecommerce_agent/" #this path should contain the agent files (eg: install.sh ,php etc)
        custom_agent_ini_file: "/etc/php/7.4/cli/conf.d/appdynamics_agent.ini" #this file should contain your agent controller details
YML

PHP Agent Variables

VariableDescriptionPossible ValuesRequiredDefault
custom_agent_ini_fileSet the absolute path of the appdynamics_agent.ini file.<custom path>
By default, it takes the default .ini file path set in PHP settings
Yes, if linux_custom_agent_install_path is definedNone
enable_cliSet to true if you want to enable the CLI mode.true or falseOptionalNone
enable_cli_long_runningSet to true to defend PHP in long-running CLI applications. See Configure the Agent for PHP CLI Applications.true or falseOptionalfalse
ignore_permissionsSet to true if you want to ignore file and directory permission issues.true or falseOptionalNone
log_directorySpecify your logs directory. By default, logs folder is created inside agent directory.<agent-directory>/logsOptional<agent-directory>/logs
php_executable_pathSpecify the path for the PHP binary./usr/bin/phpOptionalglobal php path set
php_ini_dirDirectory for the appdynamics_agent.ini file./etc/php/Required on Ubuntu and when the default PHP CLI binary cannot be determined.global php ini path set
php_extension_dirExtensions directory for the appdynamics_agent.so file. /etc/php/extensions/Required on Ubuntu and when the default PHP CLI binary cannot be determined.global php extension path set
php_versionVersion of PHP that you are instrumenting. Valid formats are version numbers to one or two decimal positions, for example, 7.4 and 7.4.29.7.4.29Required when the default PHP CLI binary cannot be determined or there is no PHP CLI binary.global php verdsion set
zts_supportSet to true to install PHP ZTS agent.true or falseOptionalfalse

Important

  1. Use the php -i|grep appdynamics_agent.ini command to get the appdynamics_agent.ini path. Set the custom_agent_ini_file with the absolute file path if your agent in not installed in default location or if you are using linux_custom_agent_install_path.
  2. If you want to install agent in PHP version which is not set globally, you must define the following variables. These are mandatory variables for all agent_action:
    • php_executable_path
    • php_ini_dir
    • php_extension_dir
    • php_version

Custom Proxy Configuration Variables

VariableDescriptionPossible ValuesRequiredDefault
proxy_hostProxy host to route data to the Controller through a proxy server.master.ecommerce-proxy.comOptionalNone
proxy_portProxy port to route data to the Controller through a proxy server.8090OptionalNone
proxy_userProxy user required to log in to proxy server host.ecommere-userOptionalNone
proxy_password_fileProxy password file to log in to proxy server host./etc/ecommerce/passwdOptionalNone
proxy_ctrl_dirThe proxy control directory. If not specified, the installer creates a temporary directory./ecommerce/proxy_dir/OptionalNone


Unable to render {include} The included page could not be found.