From d992da0c1e1840209b94b52fd4893dadfdf38bb0 Mon Sep 17 00:00:00 2001 From: Mathieu Gauthier-Pilote Date: Mon, 16 Jan 2023 10:42:41 -0500 Subject: [PATCH] use ansible_processor_count + fix db dump path --- webapps/mastodon/tasks/main.yml | 4 ++-- webapps/mastodon/tasks/upgrade.yml | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/webapps/mastodon/tasks/main.yml b/webapps/mastodon/tasks/main.yml index cecbc9ba..b2f273de 100644 --- a/webapps/mastodon/tasks/main.yml +++ b/webapps/mastodon/tasks/main.yml @@ -1,5 +1,5 @@ --- -# tasks file for mastodon +# tasks file for mastodon install - name: Install main system dependencies apt: @@ -42,7 +42,7 @@ chdir: "~/mastodon" executable: /bin/bash # fails with /bin/sh - name: Install gem dependencies - shell: ". ~/.profile && bundle install --deployment --without development test -j$(getconf _NPROCESSORS_ONLN)" + shell: ". ~/.profile && bundle install --deployment --without development test -j{{ ansible_processor_count }}" args: chdir: "~/mastodon" executable: /bin/bash # fails with /bin/sh diff --git a/webapps/mastodon/tasks/upgrade.yml b/webapps/mastodon/tasks/upgrade.yml index c2840963..e0644c66 100644 --- a/webapps/mastodon/tasks/upgrade.yml +++ b/webapps/mastodon/tasks/upgrade.yml @@ -1,11 +1,11 @@ --- -# tasks file for mastodon +# tasks file for mastodon upgrade - name: Dump database to a file with compression postgresql_db: name: "{{ service }}_production" state: dump - target: "{{ service }}_production.sql.gz" + target: "~/{{ service }}_production.sql.gz" become_user: postgres - name: Checkout (git) @@ -24,7 +24,7 @@ chdir: "~/mastodon" executable: /bin/bash # fails with /bin/sh - name: Install gem dependencies - shell: ". ~/.profile && bundle install --deployment --without development test -j$(getconf _NPROCESSORS_ONLN)" + shell: ". ~/.profile && bundle install --deployment --without development test -j{{ ansible_processor_count }}" args: chdir: "~/mastodon" executable: /bin/bash # fails with /bin/sh @@ -63,23 +63,23 @@ executable: /bin/bash # fails with /bin/sh become_user: "{{ service }}" +- name: Restart services + service: + name: "{{ service }}.target" + state: restarted + - name: Define variable to skip next task by default set_fact: keep_db_dump: true - name: Remove database dump file: - path: "{{ service }}_production.sql.gz" + path: "~/{{ service }}_production.sql.gz" state: absent become_user: postgres when: keep_db_dump is undefined tags: clean -- name: Template conf file for nginx vhost - template: - src: "vhost.j2" - dest: "/etc/nginx/sites-available/{{ service }}" - - name: Reload nginx conf service: name: nginx