diff --git a/CHANGELOG.md b/CHANGELOG.md index 69214954da..5092eb9a56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ ### HEAD +* Fix conditional logic for permalink setup task ([#467](https://github.com/roots/trellis/pull/467)) * Fix permalink setup during WordPress Install ([#466](https://github.com/roots/trellis/pull/466)) * Fix deploy pre-flight check for verifying repo ([#463](https://github.com/roots/trellis/pull/463)) * Add pre-flight checks for common deploy problems ([#459](https://github.com/roots/trellis/pull/459)) diff --git a/README.md b/README.md index e87f004f82..bab8aee255 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,7 @@ For example: configure the sites on your Vagrant development VM by editing `grou * `admin_user` - WP admin user name (*development* only, required) * `admin_email` - WP admin email address (*development* only, required) * `admin_password` - WP admin user password (*development* only, required, in `vault.yml`) +* `initial_permalink_structure` - permalink structure applied at time of WP install (*development* only, default: `/%postname%/`) * `multisite` - hash of multisite options. See the [Multisite docs](https://roots.io/trellis/docs/multisite/). * `enabled` - Multisite enabled flag (required, set to `false`) * `subdomains` - subdomains option diff --git a/group_vars/development/wordpress_sites.yml b/group_vars/development/wordpress_sites.yml index 69b5d4a677..23cc06eb8f 100644 --- a/group_vars/development/wordpress_sites.yml +++ b/group_vars/development/wordpress_sites.yml @@ -9,7 +9,7 @@ wordpress_sites: admin_user: admin # admin_password: (defined in group_vars/development/vault.yml) admin_email: admin@example.dev - permalink_structure: "/%postname%/" + initial_permalink_structure: /%postname%/ # applied only at time of WP install and when `site_install: true` multisite: enabled: false subdomains: false diff --git a/group_vars/production/wordpress_sites.yml b/group_vars/production/wordpress_sites.yml index 1f4d8a11d9..510618f038 100644 --- a/group_vars/production/wordpress_sites.yml +++ b/group_vars/production/wordpress_sites.yml @@ -7,7 +7,6 @@ wordpress_sites: repo: git@github.com:roots/bedrock.git branch: master # repo_subtree_path: site # relative path to your Bedrock/WP directory in your repo (above) if it is not the root (like the roots-example-project structure) - permalink_structure: "/%postname%/" multisite: enabled: false subdomains: false diff --git a/group_vars/staging/wordpress_sites.yml b/group_vars/staging/wordpress_sites.yml index a2f79b64da..b6e3703128 100644 --- a/group_vars/staging/wordpress_sites.yml +++ b/group_vars/staging/wordpress_sites.yml @@ -7,7 +7,6 @@ wordpress_sites: repo: git@github.com:roots/bedrock.git branch: master # repo_subtree_path: site # relative path to your Bedrock/WP directory in your repo (above) if it is not the root (like the roots-example-project structure) - permalink_structure: "/%postname%/" multisite: enabled: false subdomains: false diff --git a/roles/wordpress-install/tasks/main.yml b/roles/wordpress-install/tasks/main.yml index ee4fe3dc8b..27af5e42bb 100644 --- a/roles/wordpress-install/tasks/main.yml +++ b/roles/wordpress-install/tasks/main.yml @@ -38,26 +38,13 @@ when: item.value.site_install == True and (item.value.multisite.enabled | default(False) == False) changed_when: "'WordPress is already installed.' not in wp_install_results.stdout" -- name: Check Existing Permalink Structure - command: wp rewrite list --format=count - --allow-root - --url="{{ item.value.env.wp_home }}" - args: - chdir: "{{ www_root }}/{{ item.key }}/current/" - register: wp_permalink_check_results - with_dict: wordpress_sites - when: item.value.site_install and not item.value.multisite.enabled | default(false) - changed_when: False - - name: Setup Permalink Structure - command: wp rewrite structure {{ item.value.permalink_structure | default("/%postname%/") }} + command: wp rewrite structure {{ item.value.initial_permalink_structure | default("/%postname%/") }} --allow-root - --url="{{ item.value.env.wp_home }}" args: chdir: "{{ www_root }}/{{ item.key }}/current/" - register: wp_permalink_results with_dict: wordpress_sites - when: "wp_permalink_check_results.changed and 'No rewrite rules' in wp_permalink_check_results.results.0.stderr" + when: wp_install_results | changed - name: Install WP Multisite command: wp core multisite-install @@ -76,7 +63,6 @@ when: item.value.site_install == True and (item.value.multisite.enabled | default(False) == True) changed_when: "'The network already exists.' not in wp_install_results.stdout" - - name: Restart HHVM service: name=hhvm state=restarted when: hhvm | default(False)