Files
ansible/roles/mastodon/tasks/mastodon.yml
2024-07-05 11:53:33 +02:00

68 lines
1.6 KiB
YAML

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