feat: add remove media and preview cards to mastodon

This commit is contained in:
VC
2024-07-05 11:53:29 +02:00
parent a619ca74dd
commit 7af0cd8507
7 changed files with 31 additions and 5 deletions

View File

@@ -0,0 +1,3 @@
---
mastodon_home: "/srv/mastodon"

View File

@@ -29,6 +29,23 @@
args: args:
chdir: "{{ mastodon_home }}/live" 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 - name: install services
template: template:
src: "{{ item }}.j2" src: "{{ item }}.j2"

View File

@@ -20,7 +20,7 @@
remote_user: mastodon remote_user: mastodon
lineinfile: lineinfile:
path: "{{ mastodon_home }}/.bashrc" path: "{{ mastodon_home }}/.bashrc"
line: "eval \"$(~/.rbenv/bin/rbenv init - bash)\"" line: "eval \"$({{ mastodon_home }}/.rbenv/bin/rbenv init - bash)\""
- name: install ruby version - name: install ruby version
remote_user: mastodon remote_user: mastodon

View File

@@ -0,0 +1,4 @@
#!/bin/bash
cd {{ mastodon_home }}/live
PATH={{ mastodon_home }}/bin:{{ mastodon_home }}/.local/bin:{{ mastodon_home }}/.rbenv/plugins/ruby-build/bin:{{ mastodon_home }}/.rbenv/shims:{{ mastodon_home }}/.rbenv/bin:/usr/bin:/bin
RAILS_ENV=production bin/tootctl media remove

View File

@@ -0,0 +1,4 @@
#!/bin/bash
cd {{ mastodon_home }}/live
PATH={{ mastodon_home }}/bin:{{ mastodon_home }}/.local/bin:{{ mastodon_home }}/.rbenv/plugins/ruby-build/bin:{{ mastodon_home }}/.rbenv/shims:{{ mastodon_home }}/.rbenv/bin:/usr/bin:/bin
RAILS_ENV=production bin/tootctl preview_cards remove

View File

@@ -1,7 +1,5 @@
--- ---
mastodon_home: "/srv/mastodon"
mastodon_version: "4.0.2" mastodon_version: "4.0.2"
mastodon_nodejs_key_url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key" mastodon_nodejs_key_url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key"

View File

@@ -7,7 +7,7 @@
minute: "0" minute: "0"
hour: "19" hour: "19"
weekday: "5" weekday: "5"
job: "cd live && RAILS_ENV=production bin/tootctl media remove" job: "{{ mastodon_home }}/bin/remove_media.sh"
- name: cron for preview_cards tootctl - name: cron for preview_cards tootctl
cron: cron:
@@ -16,4 +16,4 @@
minute: "30" minute: "30"
hour: "19" hour: "19"
weekday: "5" weekday: "5"
job: "cd live && RAILS_ENV=production bin/tootctl preview_cards remove" job: "{{ mastodon_home }}/bin/remove_preview_cards.sh"