diff --git a/README.md b/README.md index ba857d9..b62afce 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,14 @@ Role Variables All variables are listed below, along with their default values in [defaults/main.yml](defaults/main.yml): -Variables for installing xdebug: +Variables for installing and configuring xdebug 2: ```yaml # The version of the xdebug package to install (ie. php7.2-xdebug) xdebug_php_version: 7.2 +xdebug_version: 2 + # xdbebug.ini settings # see: https://xdebug.org/docs/all_settings @@ -40,6 +42,35 @@ xdebug_remote_host: 10.0.2.2 xdebug_conf_remote_port: 9000 ``` +Variables for installing and configuring xdebug 3: + +```yaml +# The version of the xdebug package to install (ie. php7.2-xdebug) +xdebug_php_version: 7.2 + +xdebug_version: 3 + +# xdbebug.ini settings +# see: https://xdebug.org/docs/all_settings + +xdebug_conf_max_nesting_level: 256 +xdebug_conf_idekey: PHPSTORM + +# The mode to run xdebug in: https://xdebug.org/docs/all_settings#mode +xdebug_conf_mode: debug + +# How xdebug should be started https://xdebug.org/docs/all_settings#start_with_request +xdebug_conf_start_with_request: trigger + +# Connect to the client that sent the request +xdebug_conf_discover_client_host: 0 + +# Connect to the specified host (overidden by discover_client_host) +# 10.0.2.2 is the default IP address virtualbox assigns to the host +xdebug_conf_client_host: 10.0.2.2 +xdebug_conf_client_port: 9000 +``` + Dependencies ------------ diff --git a/defaults/main.yml b/defaults/main.yml index 079d383..117ba7e 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,13 +1,16 @@ # The version of the xdebug package to install (ie. php7.2-xdebug) xdebug_php_version: 7.2 +# Whether to configure xdebug 2 or 3 +xdebug_version: 2 + # xdbebug.ini settings # see: https://xdebug.org/docs/all_settings xdebug_conf_max_nesting_level: 256 xdebug_conf_idekey: PHPSTORM -# Start xdebug on every requset, regardless of the GET/POST variable +# Start xdebug on every request, regardless of the GET/POST variable xdebug_remote_autostart: 0 # Connect to the client that sent the request diff --git a/tasks/install.yml b/tasks/install.yml index 4f788ab..3c830ab 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -6,5 +6,12 @@ - name: configure xdebug template: - src: xdebug.ini.j2 + src: xdebug2.ini.j2 dest: /etc/php/{{ php_version }}/mods-available/xdebug.ini + when: xdebug_version == 2 + +- name: configure xdebug + template: + src: xdebug3.ini.j2 + dest: /etc/php/{{ php_version }}/mods-available/xdebug.ini + when: xdebug_version == 3 diff --git a/templates/xdebug.ini.j2 b/templates/xdebug2.ini.j2 similarity index 100% rename from templates/xdebug.ini.j2 rename to templates/xdebug2.ini.j2 diff --git a/templates/xdebug3.ini.j2 b/templates/xdebug3.ini.j2 new file mode 100644 index 0000000..08affbb --- /dev/null +++ b/templates/xdebug3.ini.j2 @@ -0,0 +1,16 @@ +zend_extension=xdebug.so +xdebug.max_nesting_level={{ xdebug_conf_max_nesting_level }} +xdebug.idekey={{ xdebug_conf_idekey }} + +; The mode to run xdebug in: https://xdebug.org/docs/all_settings#mode +xdebug.mode={{ xdebug_conf_mode }} + +; Connect to the client that made the request (overrides remote_host) +xdebug.discover_client_host={{ xdebug_conf_discover_client_host }} + +; How xdebug should be started https://xdebug.org/docs/all_settings#start_with_request +xdebug.start_with_request={{ xdebug_conf_start_with_request }} + +; Connect to specified remote host (overridden by discover_client_host) +xdebug.client_host={{ xdebug_conf_client_host }} +xdebug.client_port={{ xdebug_conf_client_port }}