83 lines
2 KiB
YAML
83 lines
2 KiB
YAML
|
|
---
|
||
|
|
|
||
|
|
- name: install base apps
|
||
|
|
apt:
|
||
|
|
force_apt_get: yes
|
||
|
|
name:
|
||
|
|
- python3-pip
|
||
|
|
|
||
|
|
- name: base path
|
||
|
|
file:
|
||
|
|
path: "/etc/fediblockhole/blocklists"
|
||
|
|
state: directory
|
||
|
|
recurse: true
|
||
|
|
|
||
|
|
- name: install/upgrade fediblockhole
|
||
|
|
command: python3 -m pip install --upgrade fediblockhole
|
||
|
|
|
||
|
|
#- name: install/upgrade Mastodon.py
|
||
|
|
# command: python3 -m pip install --upgrade Mastodon.py
|
||
|
|
|
||
|
|
- name: ensure our domain is in the safelist
|
||
|
|
lineinfile:
|
||
|
|
path: /etc/fediblockhole/safelist.csv
|
||
|
|
create: true
|
||
|
|
line: "{{ domain_name }}"
|
||
|
|
|
||
|
|
- name: check fediblockhole API credentials
|
||
|
|
delegate_to: localhost
|
||
|
|
become: false
|
||
|
|
stat:
|
||
|
|
path: credentials/fediblockhole/token
|
||
|
|
register: token_file
|
||
|
|
|
||
|
|
- name: generate a fediblockhole token
|
||
|
|
block:
|
||
|
|
|
||
|
|
- name: make fediblockhole credentials dir
|
||
|
|
delegate_to: localhost
|
||
|
|
become: false
|
||
|
|
file:
|
||
|
|
path: "credentials/fediblockhole"
|
||
|
|
state: directory
|
||
|
|
recurse: true
|
||
|
|
|
||
|
|
- name: request app token
|
||
|
|
delegate_to: localhost
|
||
|
|
become: false
|
||
|
|
command: roles/fediblockhole/bin/get_token.py {{ domain_name }} fediblockhole {{ admin_email }} credentials/mastodon/masto_admin_pw
|
||
|
|
register: apptoken
|
||
|
|
|
||
|
|
- name: write token to file
|
||
|
|
delegate_to: localhost
|
||
|
|
become: false
|
||
|
|
copy:
|
||
|
|
dest: credentials/fediblockhole/token
|
||
|
|
content: "{{ apptoken.stdout }}"
|
||
|
|
|
||
|
|
when: token_file.stat.exists != true
|
||
|
|
|
||
|
|
- name: pull config file
|
||
|
|
template:
|
||
|
|
src: templates/pull.conf.toml
|
||
|
|
dest: /etc/fediblockhole/pull.conf.toml
|
||
|
|
|
||
|
|
- name: push config file
|
||
|
|
template:
|
||
|
|
src: templates/push.conf.toml
|
||
|
|
dest: /etc/fediblockhole/push.conf.toml
|
||
|
|
vars:
|
||
|
|
token: "{{ lookup('ansible.builtin.file', 'credentials/fediblockhole/token') }}"
|
||
|
|
|
||
|
|
- name: daily cron file
|
||
|
|
copy:
|
||
|
|
dest: /etc/cron.daily/fediblockhole
|
||
|
|
mode: '0755'
|
||
|
|
content: |
|
||
|
|
#!/bin/bash
|
||
|
|
|
||
|
|
set -e
|
||
|
|
/usr/local/bin/fediblock-sync -c /etc/fediblockhole/pull.conf.toml
|
||
|
|
/usr/local/bin/fediblock-sync -c /etc/fediblockhole/push.conf.toml
|
||
|
|
|