Refactor out a remote_versions_root variable
This commit is contained in:
parent
c13114b0cc
commit
49cc2224b6
1 changed files with 4 additions and 3 deletions
|
@ -4,6 +4,7 @@
|
||||||
vars:
|
vars:
|
||||||
skip_build: no # Can override this by running `yarn deploy-skip-build`
|
skip_build: no # Can override this by running `yarn deploy-skip-build`
|
||||||
local_app_root: "{{ playbook_dir }}/../.."
|
local_app_root: "{{ playbook_dir }}/../.."
|
||||||
|
remote_versions_root: "/srv/impress-2020/versions"
|
||||||
tasks:
|
tasks:
|
||||||
# For our deployment, our server resources are more constrained than our
|
# For our deployment, our server resources are more constrained than our
|
||||||
# dev machine, and builds are an expensive uncommon RAM & CPU spike. Let's
|
# dev machine, and builds are an expensive uncommon RAM & CPU spike. Let's
|
||||||
|
@ -26,7 +27,7 @@
|
||||||
|
|
||||||
- name: Save new remote folder path to a variable
|
- name: Save new remote folder path to a variable
|
||||||
set_fact:
|
set_fact:
|
||||||
remote_app_root: "/srv/impress-2020/versions/{{ new_app_version.stdout }}"
|
remote_app_root: "{{ remote_versions_root }}/{{ new_app_version.stdout }}"
|
||||||
|
|
||||||
- name: Create new remote folder for the new version
|
- name: Create new remote folder for the new version
|
||||||
file:
|
file:
|
||||||
|
@ -59,12 +60,12 @@
|
||||||
- name: Find older versions to clean up
|
- name: Find older versions to clean up
|
||||||
# Print out all but the 5 last-recently-updated versions
|
# Print out all but the 5 last-recently-updated versions
|
||||||
command:
|
command:
|
||||||
chdir: /srv/impress-2020/versions
|
chdir: "{{ remote_versions_root }}"
|
||||||
cmd: bash -c 'ls -t | tail -n +6'
|
cmd: bash -c 'ls -t | tail -n +6'
|
||||||
register: versions_to_clean_up
|
register: versions_to_clean_up
|
||||||
|
|
||||||
- name: Clean up older versions
|
- name: Clean up older versions
|
||||||
file:
|
file:
|
||||||
path: "/srv/impress-2020/versions/{{ item }}"
|
path: "{{ remote_versions_root }}/{{ item }}"
|
||||||
state: absent
|
state: absent
|
||||||
with_items: "{{ versions_to_clean_up.stdout_lines }}"
|
with_items: "{{ versions_to_clean_up.stdout_lines }}"
|
||||||
|
|
Loading…
Reference in a new issue