From 7e1e5f4422115d38c6de545ec12821f433ac3403 Mon Sep 17 00:00:00 2001 From: Dryusdan Date: Mon, 23 Jan 2023 17:22:46 +0100 Subject: [PATCH] Add cleaning after action --- handlers/main.yml | 17 +++++++++++++++++ tasks/install.yml | 8 +++++--- tasks/update.yml | 2 ++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 3a89109..2fcc359 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -8,3 +8,20 @@ tags: - install +- name: "Clean cache yarn" + shell: "yarn cache clean" + args: + chdir: "{{ item.home }}/" + become: yes + become_user: "{{ item.account }}" + loop: "{{ ghost }}" + when: ghost_deploy_site in item.name + +- name: "NPM Cache clean" + shell: "npm cache clean --force" + args: + chdir: "{{ item.home }}/" + become: yes + become_user: "{{ item.account }}" + loop: "{{ ghost }}" + when: ghost_deploy_site in item.name diff --git a/tasks/install.yml b/tasks/install.yml index da51548..8efefb4 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -18,7 +18,7 @@ group: "{{ item.account }}" loop: "{{ ghost }}" become: yes - become_user : "{{ item.account }}" + become_user: "{{ item.account }}" when: ghost_deploy_site in item.name tags: - install @@ -29,7 +29,7 @@ chdir: "{{ item.home }}" loop: "{{ ghost }}" become: yes - become_user : "{{ item.account }}" + become_user: "{{ item.account }}" when: ghost_deploy_site in item.name tags: - install @@ -40,10 +40,12 @@ chdir: "{{ item.home }}" loop: "{{ ghost }}" become: yes - become_user : "{{ item.account }}" + become_user: "{{ item.account }}" when: ghost_deploy_site in item.name tags: - install notify: - Restart service + - Clean cache yarn + - NPM Cache clean diff --git a/tasks/update.yml b/tasks/update.yml index afe2ae0..3faa234 100644 --- a/tasks/update.yml +++ b/tasks/update.yml @@ -11,3 +11,5 @@ - update notify: - Restart service + - Clean cache yarn + - NPM Cache clean