FloeDesignTechnologies / ansible-nginx-drupal

Ansible role to configure Nginx for running Drupal using perusio's configuration
Apache License 2.0
22 stars 12 forks source link

Doesn't work with Drupal 6 #5

Open praseodym opened 10 years ago

praseodym commented 10 years ago

The drupal.j2 configuration doesn't work with Drupal 6 out of the box, mainly because it requires leading slashes to be stripped.

For example, see https://github.com/perusio/drupal-with-nginx/blob/D6/apps/drupal/drupal6.conf#L226

pbuyle commented 10 years ago

If I'm not mistaken, the master branch of perusio's configuration is compatible with both Drupal 6 and 7. So the Drupal version is a property of the configured sites. The change would be to have Drupal version passed as a property of sites in nginx_drupal_sites and a different template should be used for each supported version. The default version for sites with no version property should be configurable via a role variable (nginx_drupal_default_version).

praseodym commented 10 years ago

I see; I was using the D6 branch. Main problem is that the site template needs to be changed for Drupal 6. I think this could also be implemented through some conditionals in a single template.

pbuyle commented 10 years ago

If the changes were simple enough to allow a single template then yes, conditionals in the sites-availables/drupal-site.j2 template would be the way to go. But the file that need to be changed is shared by multiple sites.

AFAIK, it should be possible to use a single nginx configuration for a server with Drupal 6 and 7. If Drupal 6 support is worked on, I would prefer to see it made in a way that allow this.

So the solution would be to have a apps/drupal/drupal6.j2 parametrized template based on https://github.com/perusio/drupal-with-nginx/blob/master/apps/drupal/drupal6.conf. The file include in sites-availables/drupal-site.j2 should use a condition to check which version to use. the condition should be something like item.version|default(nginx_drupal_default_version) == 6, nginx_drupal_default_version should be added to defaults/main.yml and documented in the README.md. The default value of nginx_drupal_default_version should be something like {{ 6 if (nginx_drupal_git.version = 'D6') else 7 }}.