Skip to content

Commit def8e47

Browse files
committed
Apply safe Ansible cleanup refactors
1 parent 89ba476 commit def8e47

7 files changed

Lines changed: 35 additions & 17 deletions

File tree

tasks/rsync-deploy.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,27 @@
1919
path: "{{ ansistrano_deploy_to }}/{{ ansistrano_current_dir }}"
2020

2121
- name: ANSISTRANO | Sync release to new current path
22-
command: rsync -a -F --no-times --delete-after "{{ ansistrano_release_path.stdout }}/" "{{ ansistrano_deploy_to }}/{{ ansistrano_current_dir }}/"
22+
command:
23+
argv:
24+
- rsync
25+
- -a
26+
- -F
27+
- --no-times
28+
- --delete-after
29+
- "{{ ansistrano_release_path.stdout }}/"
30+
- "{{ ansistrano_deploy_to }}/{{ ansistrano_current_dir }}/"
2331

2432
# Ensure symlinks target paths is absent
2533
- name: ANSISTRANO | Ensure shared paths targets are absent
2634
file:
2735
state: absent
2836
path: "{{ ansistrano_deploy_to }}/{{ ansistrano_current_dir }}/{{ item }}"
29-
with_flattened:
30-
- "{{ ansistrano_shared_paths }}"
31-
- "{{ ansistrano_shared_files }}"
37+
loop: "{{ ansistrano_shared_paths + ansistrano_shared_files }}"
3238

3339
# Symlinks shared paths
3440
- name: ANSISTRANO | Create softlinks for shared paths
3541
file:
3642
state: link
3743
path: "{{ ansistrano_deploy_to }}/{{ ansistrano_current_dir }}/{{ item }}"
3844
src: "{{ item | regex_replace('[^\\/]+', '..') }}/{{ ansistrano_shared_dir }}/{{ item }}"
39-
with_flattened:
40-
- "{{ ansistrano_shared_paths }}"
41-
- "{{ ansistrano_shared_files }}"
45+
loop: "{{ ansistrano_shared_paths + ansistrano_shared_files }}"

tasks/setup.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
file:
2121
state: directory
2222
path: "{{ ansistrano_shared_path }}/{{ item }}"
23-
with_items: "{{ ansistrano_shared_paths }}"
24-
when: ansistrano_ensure_shared_paths_exist|bool
23+
loop: "{{ ansistrano_shared_paths }}"
24+
when: ansistrano_ensure_shared_paths_exist | bool
2525

2626
# Ensure basedir shared files exists
2727
- name: ANSISTRANO | Ensure basedir shared files exists
2828
file:
2929
state: directory
3030
path: "{{ ansistrano_shared_path }}/{{ item | dirname }}"
31-
with_items: "{{ ansistrano_shared_files }}"
32-
when: ansistrano_ensure_basedirs_shared_files_exist|bool
31+
loop: "{{ ansistrano_shared_files }}"
32+
when: ansistrano_ensure_basedirs_shared_files_exist | bool

tasks/update-code.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@
1818
copy:
1919
content: "{{ ansistrano_release_version }}"
2020
dest: "{{ ansistrano_release_path.stdout }}/REVISION"
21-
when: ansistrano_git_result is not defined or ansistrano_git_result is none
21+
when:
22+
- ansistrano_git_result is not defined or ansistrano_git_result is none
2223

2324
- name: ANSISTRANO | Copy git released version into REVISION file
2425
copy:
2526
content: "{{ ansistrano_git_result.after | default(ansistrano_release_version) }}"
2627
dest: "{{ ansistrano_release_path.stdout }}/REVISION"
27-
when: ansistrano_git_result is defined and ansistrano_git_result is not none
28+
when:
29+
- ansistrano_git_result is defined
30+
- ansistrano_git_result is not none

tasks/update-code/download.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
state: directory
55
path: "{{ ansistrano_release_path.stdout }}"
66

7-
# We should be able to remove default(omit) filters and add defaults once we deprecate Ansible 1.9
87
- name: ANSISTRANO | download | Download artifact
98
get_url:
109
url: "{{ ansistrano_get_url }}"

tasks/update-code/hg.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
path: "{{ ansistrano_release_path.stdout }}"
1414

1515
- name: ANSISTRANO | HG | Sync repo to release path
16-
command: "hg archive -r {{ ansistrano_hg_branch }} {{ ansistrano_release_path.stdout }}"
16+
command:
17+
argv:
18+
- hg
19+
- archive
20+
- -r
21+
- "{{ ansistrano_hg_branch }}"
22+
- "{{ ansistrano_release_path.stdout }}"
1723
args:
1824
chdir: "{{ ansistrano_deploy_to }}/{{ ansistrano_repo_dir }}/"

tasks/update-code/rsync.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,9 @@
1818
rsync_path: "{{ ansistrano_rsync_path | default(omit) }}"
1919

2020
- name: ANSISTRANO | RSYNC | Deploy existing code to servers
21-
command: cp -a {{ ansistrano_shared_rsync_copy_path.stdout }} {{ ansistrano_release_path.stdout }}
21+
command:
22+
argv:
23+
- cp
24+
- -a
25+
- "{{ ansistrano_shared_rsync_copy_path.stdout }}"
26+
- "{{ ansistrano_release_path.stdout }}"

tasks/update-code/svn.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
register: ansistrano_svn_result_update
1212

1313
- name: ANSISTRANO | SVN | Register ansistrano_svn_result variable
14-
set_fact: ansistrano_svn_result={{ ansistrano_svn_result_update }}
14+
set_fact:
15+
ansistrano_svn_result: "{{ ansistrano_svn_result_update }}"
1516

1617
- name: ANSISTRANO | SVN | Create release folder
1718
file:

0 commit comments

Comments
 (0)