Files
ansible/roles/mastodon/tasks/mastodon.yml

65 lines
1.4 KiB
YAML

---
- name: git mastodon
remote_user: mastodon
git:
repo: "https://github.com/mastodon/mastodon.git"
dest: "{{ mastodon_home }}/live"
version: "v{{ mastodon_version }}"
- name: bundle config command
remote_user: mastodon
shell: |
bash -lic "bundle config deployment 'true' && bundle config without 'development test'"
args:
creates: "{{ mastodon_home }}/.bundle/config"
chdir: "{{ mastodon_home }}/live"
- name: bundle install
remote_user: mastodon
shell: |
bash -lic "bundle install -j$(getconf _NPROCESSORS_ONLN)"
args:
chdir: "{{ mastodon_home }}/live"
- name: yarn install
remote_user: mastodon
shell: |
bash -lic "yarn install --pure-lockfile"
args:
chdir: "{{ mastodon_home }}/live"
- name: create bin dir
remote_user: mastodon
file:
path: "{{ mastodon_home }}/bin"
state: directory
mode: '0750'
- name: template scripts
remote_user: mastodon
template:
src: "{{ item }}.j2"
dest: "{{ mastodon_home }}/bin/{{ item }}"
mode: '0750'
loop:
- remove_media.sh
- remove_preview_cards.sh
- name: install services
template:
src: "{{ item }}.j2"
dest: "/etc/systemd/system/{{ item }}"
loop: &mastodon_services
- "mastodon-sidekiq.service"
- "mastodon-streaming.service"
- "mastodon-web.service"
- name: run services
systemd:
name: "{{ item }}"
daemon_reload: true
state: started
enabled: true
loop: *mastodon_services