--- - name: Get mastodon git remote_user: mastodon ansible.builtin.git: repo: "https://github.com/mastodon/mastodon.git" dest: "{{ mastodon_home }}/live" version: "v{{ mastodon_version }}" - name: Exec bundle 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: Install bundle remote_user: mastodon ansible.builtin.command: cmd: | bash -lic "bundle install -j$(getconf _NPROCESSORS_ONLN)" chdir: "{{ mastodon_home }}/live" changed_when: true - name: Install mastodon remote_user: mastodon ansible.builtin.command: cmd: | bash -lic "yarn install --frozen-lockfile" chdir: "{{ mastodon_home }}/live" changed_when: true - name: Precompile assets remote_user: mastodon ansible.builtin.command: cmd: | bash -lic "RAILS_ENV=production bundle exec rails assets:precompile" chdir: "{{ mastodon_home }}/live" changed_when: true - name: Create bin dir remote_user: mastodon ansible.builtin.file: path: "{{ mastodon_home }}/bin" state: directory mode: "0o750" - name: Put template scripts remote_user: mastodon ansible.builtin.template: src: "{{ item }}.j2" dest: "{{ mastodon_home }}/bin/{{ item }}" mode: "0o750" loop: - remove_media.sh - remove_preview_cards.sh - name: Install services ansible.builtin.template: src: "{{ item }}.j2" dest: "/etc/systemd/system/{{ item }}" mode: "0o644" loop: - "mastodon-sidekiq.service" - "mastodon-streaming.service" - "mastodon-streaming@.service" - "mastodon-web.service" - name: Run services ansible.builtin.systemd: name: "{{ item }}" daemon_reload: true state: started enabled: true loop: - "mastodon-sidekiq.service" - "mastodon-streaming@4000.service" - "mastodon-web.service"