Skip to content
This repository was archived by the owner on Oct 8, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions roles/_init/tasks/custom.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
---

# Nothing to do here.
# Nothing to do here.
13 changes: 5 additions & 8 deletions roles/_init/tasks/drupal7.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
---
- name: Define path to drush for this build.
set_fact:
drush_bin: "{{ drush_bin | default('{{ bin_directory }}/drush.phar') }}"

- name: Define path to drush for currently live build. # usually the same as drush_bin for Drupal 7
set_fact:
drush_live_bin: "{{ drush_live_bin | default('{{ bin_directory }}/drush.phar') }}"
- name: Define paths to drush for this build.
ansible.builtin.set_fact:
drush_bin: "{{ drush_bin | default(bin_directory + '/drush.phar') }}"
drush_live_bin: "{{ drush_live_bin | default(bin_directory + '/drush.phar') }}" # usually the same as drush_bin for Drupal 7

- name: Ensure we have a drush binary.
import_role:
ansible.builtin.import_role:
name: cli/drush

- name: Ensure we have a cachetool binary and configuration.
Expand Down
6 changes: 3 additions & 3 deletions roles/_init/tasks/drupal8.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
- name: Define path to drush for this build.
ansible.builtin.set_fact:
drush_bin: "{{ drush_bin | default('{{ deploy_path }}/vendor/bin/drush') }}"
drush_bin: "{{ drush_bin | default(deploy_path + '/vendor/bin/drush') }}"

- name: Define path to drush for previous build.
ansible.builtin.set_fact:
previous_drush_bin: "{{ previous_drush_bin | default('{{ previous_deploy_path }}/vendor/bin/drush') }}"
previous_drush_bin: "{{ previous_drush_bin | default(previous_deploy_path + '/vendor/bin/drush') }}"

- name: Define path to drush for currently live build.
ansible.builtin.set_fact:
drush_live_bin: "{{ drush_live_bin | default('{{ live_symlink_dest }}/vendor/bin/drush') }}"
drush_live_bin: "{{ drush_live_bin | default(live_symlink_dest + '/vendor/bin/drush') }}"

- name: Ensure we have a cachetool binary and configuration.
ansible.builtin.import_role:
Expand Down
32 changes: 13 additions & 19 deletions roles/_init/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,34 +30,28 @@
ansible.builtin.set_fact:
deploy_user: "{{ deploy_user | default('deploy') }}"

- name: Define deploy base path.
- name: Define initial deploy paths.
ansible.builtin.set_fact:
deploy_base_path: "{{ deploy_base_path | default('/home/{{ deploy_user }}/deploy/{{ project_name }}_{{ build_type }}') }}"
deploy_base_path: "{{ deploy_base_path | default('/home/' + deploy_user + '/deploy/' + project_name + '_' + build_type) }}"
deploy_assets_base_path: "{{ deploy_assets_base_path | default('/home/' + deploy_user + '/shared/' + project_name + '_' + build_type + '/assets') }}"
webroot: "{{ webroot | default('web') }}"

- name: Define mounted directory for assets.
- name: Define deploy_path_prefix variable.
ansible.builtin.set_fact:
deploy_assets_base_path: "{{ deploy_assets_base_path | default('/home/{{ deploy_user }}/shared/{{ project_name }}_{{ build_type }}/assets') }}"
deploy_path_prefix: "{{ deploy_base_path }}/{{ project_name }}_{{ build_type }}_build_"

- name: Define webroot.
- name: Define final deploy_path variable.
ansible.builtin.set_fact:
webroot: "{{ webroot | default('web') }}"
deploy_path: "{{ deploy_path | default(deploy_path_prefix + build_number|string) }}"

# This is passed from caller.
- name: Gather last known good build number.
ansible.builtin.set_fact:
previous_build_number: "{{ previous_known_build_number }}"

- name: Define build deploy path prefix.
ansible.builtin.set_fact:
deploy_path_prefix: "{{ deploy_base_path }}/{{ project_name }}_{{ build_type }}_build_"

- name: Define build deploy path.
ansible.builtin.set_fact:
deploy_path: "{{ deploy_path | default('{{ deploy_path_prefix }}{{ build_number }}') }}"

- name: Define live_symlink dest.
ansible.builtin.set_fact:
live_symlink_dest: "{{ live_symlink_dest | default('{{ deploy_base_path }}/live.{{ project_name }}_{{ build_type }}') }}"
live_symlink_dest: "{{ live_symlink_dest | default(deploy_base_path + '/live.' + project_name + '_' + build_type) }}"

- name: Read the live symlink to get the path to the current build.
ansible.builtin.stat:
Expand Down Expand Up @@ -85,7 +79,7 @@
msg: "Track file ID: {{ previous_build_number }}. Build path ID: {{ _current_build_id }}. These should match, something is wrong, failing the build."
when:
- _current_build_path.stat.islnk
- _current_build_id | int != previous_build_number | int
- _current_build_id|int != previous_build_number|int
- not skip_build_path_check

- name: Define opcache cachetool path.
Expand Down Expand Up @@ -114,11 +108,11 @@

- name: Define live_symlink dest for image builds.
ansible.builtin.set_fact:
live_symlink_build_dest: "{{ live_symlink_build_dest | default('{{ build_base_path }}/live.{{ project_name }}_{{ build_type }}') }}"
live_symlink_build_dest: "{{ live_symlink_build_dest | default(build_base_path + '/live.' + project_name + '_' + build_type) }}"

- name: Overwrite deploy and live_symlink paths if SquashFS deploy.
ansible.builtin.set_fact:
deploy_path: "{{ build_path | default('{{ build_path_prefix }}{{ build_number }}') }}"
deploy_path: "{{ build_path | default(build_path_prefix + build_number|string) }}"

- name: Overwrite cachetool path if SquashFS deploy and path not provided.
ansible.builtin.set_fact:
Expand Down Expand Up @@ -206,7 +200,7 @@

- name: Set the previous deploy's path for later use where we need to manipulate the live site.
ansible.builtin.set_fact:
previous_deploy_path: "{{ previous_deploy_path | default('{{ deploy_path_prefix }}{{ previous_build_number }}') }}"
previous_deploy_path: "{{ previous_deploy_path | default(deploy_path_prefix + previous_build_number|string) }}"

# Make sure the deploy target exists.
- name: Ensure deploy target directory exists.
Expand Down