| 
30 | 30 |   ansible.builtin.set_fact:  | 
31 | 31 |     deploy_user: "{{ deploy_user | default('deploy') }}"  | 
32 | 32 | 
 
  | 
33 |  | -- name: Define deploy base path.  | 
 | 33 | +- name: Define initial deploy paths.  | 
34 | 34 |   ansible.builtin.set_fact:  | 
35 |  | -    deploy_base_path: "{{ deploy_base_path | default('/home/{{ deploy_user }}/deploy/{{ project_name }}_{{ build_type }}') }}"  | 
 | 35 | +    deploy_base_path: "{{ deploy_base_path | default('/home/' + deploy_user + '/deploy/' + project_name + '_' + build_type) }}"  | 
 | 36 | +    deploy_assets_base_path: "{{ deploy_assets_base_path | default('/home/' + deploy_user + '/shared/' + project_name + '_' + build_type + '/assets') }}"  | 
 | 37 | +    webroot: "{{ webroot | default('web') }}"  | 
36 | 38 | 
 
  | 
37 |  | -- name: Define mounted directory for assets.  | 
 | 39 | +- name: Define deploy_path_prefix variable.  | 
38 | 40 |   ansible.builtin.set_fact:  | 
39 |  | -    deploy_assets_base_path: "{{ deploy_assets_base_path | default('/home/{{ deploy_user }}/shared/{{ project_name }}_{{ build_type }}/assets') }}"  | 
 | 41 | +    deploy_path_prefix: "{{ deploy_base_path }}/{{ project_name }}_{{ build_type }}_build_"  | 
40 | 42 | 
 
  | 
41 |  | -- name: Define webroot.  | 
 | 43 | +- name: Define final deploy_path variable.  | 
42 | 44 |   ansible.builtin.set_fact:  | 
43 |  | -    webroot: "{{ webroot | default('web') }}"  | 
 | 45 | +    deploy_path: "{{ deploy_path | default(deploy_path_prefix + build_number|string) }}"  | 
44 | 46 | 
 
  | 
45 | 47 | # This is passed from caller.  | 
46 | 48 | - name: Gather last known good build number.  | 
47 | 49 |   ansible.builtin.set_fact:  | 
48 | 50 |     previous_build_number: "{{ previous_known_build_number }}"  | 
49 | 51 | 
 
  | 
50 |  | -- name: Define build deploy path prefix.  | 
51 |  | -  ansible.builtin.set_fact:  | 
52 |  | -    deploy_path_prefix: "{{ deploy_base_path }}/{{ project_name }}_{{ build_type }}_build_"  | 
53 |  | - | 
54 |  | -- name: Define build deploy path.  | 
55 |  | -  ansible.builtin.set_fact:  | 
56 |  | -    deploy_path: "{{ deploy_path | default('{{ deploy_path_prefix }}{{ build_number }}') }}"  | 
57 |  | - | 
58 | 52 | - name: Define live_symlink dest.  | 
59 | 53 |   ansible.builtin.set_fact:  | 
60 |  | -    live_symlink_dest: "{{ live_symlink_dest | default('{{ deploy_base_path }}/live.{{ project_name }}_{{ build_type }}') }}"  | 
 | 54 | +    live_symlink_dest: "{{ live_symlink_dest | default(deploy_base_path + '/live.' + project_name + '_' + build_type) }}"  | 
61 | 55 | 
 
  | 
62 | 56 | - name: Read the live symlink to get the path to the current build.  | 
63 | 57 |   ansible.builtin.stat:  | 
 | 
85 | 79 |         msg: "Track file ID: {{ previous_build_number }}. Build path ID: {{ _current_build_id }}. These should match, something is wrong, failing the build."  | 
86 | 80 |       when:  | 
87 | 81 |         - _current_build_path.stat.islnk  | 
88 |  | -        - _current_build_id | int != previous_build_number | int  | 
 | 82 | +        - _current_build_id|int != previous_build_number|int  | 
89 | 83 |         - not skip_build_path_check  | 
90 | 84 | 
 
  | 
91 | 85 | - name: Define opcache cachetool path.  | 
 | 
114 | 108 | 
 
  | 
115 | 109 |     - name: Define live_symlink dest for image builds.  | 
116 | 110 |       ansible.builtin.set_fact:  | 
117 |  | -        live_symlink_build_dest: "{{ live_symlink_build_dest | default('{{ build_base_path }}/live.{{ project_name }}_{{ build_type }}') }}"  | 
 | 111 | +        live_symlink_build_dest: "{{ live_symlink_build_dest | default(build_base_path + '/live.' + project_name + '_' + build_type) }}"  | 
118 | 112 | 
 
  | 
119 | 113 |     - name: Overwrite deploy and live_symlink paths if SquashFS deploy.  | 
120 | 114 |       ansible.builtin.set_fact:  | 
121 |  | -        deploy_path: "{{ build_path | default('{{ build_path_prefix }}{{ build_number }}') }}"  | 
 | 115 | +        deploy_path: "{{ build_path | default(build_path_prefix + build_number|string) }}"  | 
122 | 116 | 
 
  | 
123 | 117 |     - name: Overwrite cachetool path if SquashFS deploy and path not provided.  | 
124 | 118 |       ansible.builtin.set_fact:  | 
 | 
206 | 200 | 
 
  | 
207 | 201 | - name: Set the previous deploy's path for later use where we need to manipulate the live site.  | 
208 | 202 |   ansible.builtin.set_fact:  | 
209 |  | -    previous_deploy_path: "{{ previous_deploy_path | default('{{ deploy_path_prefix }}{{ previous_build_number }}') }}"  | 
 | 203 | +    previous_deploy_path: "{{ previous_deploy_path | default(deploy_path_prefix + previous_build_number|string) }}"  | 
210 | 204 | 
 
  | 
211 | 205 | # Make sure the deploy target exists.  | 
212 | 206 | - name: Ensure deploy target directory exists.  | 
 | 
0 commit comments