0
0
opnxng-deploy-playbook/config-tasks/nitter.yaml

125 lines
3.4 KiB
YAML
Raw Normal View History

2023-11-06 10:39:27 +08:00
- name: Generate JWT Secret
command: openssl rand -hex 32
register: nitter_jwt_secret_result
- set_fact:
nitter_jwt_secret: "{{ nitter_jwt_secret_result.stdout }}"
- name: Set up nitter conf
template:
2023-12-08 09:12:57 +08:00
src: "conf/nitter/nitter.conf.j2"
2023-11-06 10:39:27 +08:00
dest: "{{ docker_dir }}/nitter/nitter.conf"
owner: 1000
group: 1000
mode: 0755
- name: Copy about.md
copy:
src: "nitter/about.md"
dest: "{{ docker_dir }}/nitter/about.md"
owner: 1000
group: 1000
mode: 0755
- name: Copy about.html
copy:
src: "nitter/about.html"
dest: "{{ docker_dir }}/nitter/about.html"
owner: 1000
group: 1000
mode: 0755
2023-12-08 09:12:57 +08:00
# --------------------------------------------------------------------------------------------------
- name: Create nginx directory
file:
path: "{{ docker_dir }}/nitter/nginx"
state: directory
owner: 1000
group: 1000
mode: 0775
- name: Touch nitter_error.log
file:
path: "{{ docker_dir }}/nitter/nginx/nitter_error.log"
state: touch
owner: 1000
group: 1000
mode: 0775
- name: Set up nginx.conf.j2
template:
src: "conf/nitter/nginx.conf.j2"
dest: "{{ docker_dir }}/nitter/nginx/nginx.conf"
owner: 1000
group: 1000
mode: 0755
- name: Set up nginx
template:
src: "conf/nitter/nginx.j2"
dest: "{{ docker_dir }}/nitter/nginx/nginx"
owner: 1000
group: 1000
mode: 0755
- name: Create shared_cache.conf
copy:
dest: "{{ docker_dir }}/nitter/nginx/shared_cache.conf"
content: |
proxy_buffers 64 16k;
proxy_buffer_size 4k;
expires 90d;
access_log off;
resolver 127.0.0.11;
set $backend "nitter";
proxy_pass http://$backend:8080;
- name: Create shared_static.conf
copy:
dest: "{{ docker_dir }}/nitter/nginx/shared_static.conf"
content: |
expires 90d;
access_log off;
root /src/public;
- name: Clone nitter repo to /tmp
git:
repo: https://github.com/zedeus/nitter.git
dest: "/tmp/nitter"
single_branch: true
version: guest_accounts
- name: Copy the public folder to the specified directory
command: "cp -r /tmp/nitter/public {{ docker_dir }}/nitter/nginx/"
# --------------------------------------------------------------------------------------------------
- name: Create fail2ban directory
file:
path: "{{ docker_dir }}/nitter/fail2ban"
state: directory
owner: 1000
group: 1000
mode: 0775
- name: Set up jail.local
template:
src: "conf/nitter/jail.local.j2"
dest: "{{ docker_dir }}/nitter/fail2ban/jail.local"
owner: 1000
group: 1000
mode: 0755
# --------------------------------------------------------------------------------------------------
2023-11-06 10:39:27 +08:00
- name: Curl guest_accounts.jsonl
shell: curl -s '{{ twitterminator_url }}' > {{ docker_dir }}/nitter/guest_accounts.jsonl
ignore_errors: true
- name: Chmod guest_accounts.jsonl
command: chmod 0777 {{ docker_dir }}/nitter/guest_accounts.jsonl
- name: Chown guest_accounts.jsonl
2023-12-08 09:12:57 +08:00
command: chown 1000:1000 {{ docker_dir }}/nitter/guest_accounts.jsonl