mastible/roles/mastodon-config/tasks/main.yml

43 lines
1.4 KiB
YAML
Raw Permalink Normal View History

2017-11-27 01:58:45 +00:00
---
# This role pre-compiles assets, starts Mastodon daemons,
# adds media cleanup cron job
2017-11-27 01:58:45 +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
environment:
RAILS_ENV: production
PATH: '/home/mastodon/.rbenv/bin:/home/mastodon/.rbenv/shims:/home/mastodon/.rbenv/plugins/ruby-build/bin:{{ ansible_env.PATH }}'
args:
executable: /bin/bash
become: true
become_user: mastodon
- name: Precompile Mastodon static assets
shell: cd /home/mastodon/live && bundle exec rails assets:precompile
2017-11-27 01:58:45 +00:00
environment:
RAILS_ENV: production
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
2019-02-21 16:28:09 +00:00
job: "cd /home/mastodon/live && RAILS_ENV=production /home/mastodon/.rbenv/shims/bundle exec /home/mastodon/live/bin/tootctl media remove"
2017-11-27 01:58:45 +00:00
backup: yes
state: present
become: true
become_user: mastodon
- name: (Re)Start Mastodon services and nginx
systemd: name={{ item }} state=restarted
2017-11-27 01:58:45 +00:00
with_items:
- mastodon-sidekiq
- mastodon-streaming
- mastodon-web
- nginx