2017-11-27 01:58:45 +00:00
|
|
|
---
|
2018-08-23 20:53:25 +00:00
|
|
|
# This role pre-compiles assets, starts Mastodon daemons,
|
|
|
|
# adds media cleanup cron job
|
2017-11-27 01:58:45 +00:00
|
|
|
|
2018-08-23 20:53:25 +00:00
|
|
|
- name: Run install tasks
|
|
|
|
include_tasks: install.yml
|
|
|
|
when: install is defined
|
|
|
|
- name: Run Mastodon database migration
|
|
|
|
when: install is not defined
|
|
|
|
shell: cd /home/mastodon/live && bundle exec rails db:migrate
|
2017-11-27 02:59:48 +00:00
|
|
|
environment:
|
|
|
|
RAILS_ENV: production
|
2017-11-27 18:18:27 +00:00
|
|
|
PATH: '/home/mastodon/.rbenv/bin:/home/mastodon/.rbenv/shims:/home/mastodon/.rbenv/plugins/ruby-build/bin:{{ ansible_env.PATH }}'
|
2017-11-27 02:59:48 +00:00
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
|
|
|
become: true
|
|
|
|
become_user: mastodon
|
2017-11-27 16:54:40 +00:00
|
|
|
- name: Precompile Mastodon static assets
|
2017-11-27 18:18:27 +00:00
|
|
|
shell: cd /home/mastodon/live && bundle exec rails assets:precompile
|
2017-11-27 01:58:45 +00:00
|
|
|
environment:
|
|
|
|
RAILS_ENV: production
|
2017-11-27 18:18:27 +00:00
|
|
|
PATH: '/home/mastodon/.rbenv/bin:/home/mastodon/.rbenv/shims:/home/mastodon/.rbenv/plugins/ruby-build/bin:{{ ansible_env.PATH }}'
|
2017-11-27 01:58:45 +00:00
|
|
|
args:
|
|
|
|
executable: /bin/bash
|
|
|
|
become: true
|
|
|
|
become_user: mastodon
|
|
|
|
- name: Add Mastodon media cache cleanup cronjob
|
|
|
|
cron:
|
|
|
|
name: "Mastodon media cache cleanup"
|
|
|
|
special_time: daily
|
|
|
|
job: "cd /home/mastodon/live && RAILS_ENV=production /home/mastodon/.rbenv/shims/bundle exec rake mastodon:media:remove_remote"
|
|
|
|
backup: yes
|
|
|
|
state: present
|
|
|
|
become: true
|
|
|
|
become_user: mastodon
|
2017-11-27 16:58:11 +00:00
|
|
|
- name: (Re)Start Mastodon services
|
2017-11-27 16:48:17 +00:00
|
|
|
systemd: name={{ item }} state=restarted
|
2017-11-27 01:58:45 +00:00
|
|
|
with_items:
|
|
|
|
- mastodon-sidekiq
|
|
|
|
- mastodon-streaming
|
|
|
|
- mastodon-web
|