use ansible_processor_count + fix db dump path
All checks were successful
gitea/ansible-roles/pipeline/head This commit looks good

This commit is contained in:
Mathieu Gauthier-Pilote 2023-01-16 10:42:41 -05:00
parent 6c29a1f6d4
commit d992da0c1e
2 changed files with 11 additions and 11 deletions

View file

@ -1,5 +1,5 @@
--- ---
# tasks file for mastodon # tasks file for mastodon install
- name: Install main system dependencies - name: Install main system dependencies
apt: apt:
@ -42,7 +42,7 @@
chdir: "~/mastodon" chdir: "~/mastodon"
executable: /bin/bash # fails with /bin/sh executable: /bin/bash # fails with /bin/sh
- name: Install gem dependencies - 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: args:
chdir: "~/mastodon" chdir: "~/mastodon"
executable: /bin/bash # fails with /bin/sh executable: /bin/bash # fails with /bin/sh

View file

@ -1,11 +1,11 @@
--- ---
# tasks file for mastodon # tasks file for mastodon upgrade
- name: Dump database to a file with compression - name: Dump database to a file with compression
postgresql_db: postgresql_db:
name: "{{ service }}_production" name: "{{ service }}_production"
state: dump state: dump
target: "{{ service }}_production.sql.gz" target: "~/{{ service }}_production.sql.gz"
become_user: postgres become_user: postgres
- name: Checkout (git) - name: Checkout (git)
@ -24,7 +24,7 @@
chdir: "~/mastodon" chdir: "~/mastodon"
executable: /bin/bash # fails with /bin/sh executable: /bin/bash # fails with /bin/sh
- name: Install gem dependencies - 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: args:
chdir: "~/mastodon" chdir: "~/mastodon"
executable: /bin/bash # fails with /bin/sh executable: /bin/bash # fails with /bin/sh
@ -63,23 +63,23 @@
executable: /bin/bash # fails with /bin/sh executable: /bin/bash # fails with /bin/sh
become_user: "{{ service }}" become_user: "{{ service }}"
- name: Restart services
service:
name: "{{ service }}.target"
state: restarted
- name: Define variable to skip next task by default - name: Define variable to skip next task by default
set_fact: set_fact:
keep_db_dump: true keep_db_dump: true
- name: Remove database dump - name: Remove database dump
file: file:
path: "{{ service }}_production.sql.gz" path: "~/{{ service }}_production.sql.gz"
state: absent state: absent
become_user: postgres become_user: postgres
when: keep_db_dump is undefined when: keep_db_dump is undefined
tags: clean tags: clean
- name: Template conf file for nginx vhost
template:
src: "vhost.j2"
dest: "/etc/nginx/sites-available/{{ service }}"
- name: Reload nginx conf - name: Reload nginx conf
service: service:
name: nginx name: nginx