tootbot/tootbot.yml

52 lines
1.2 KiB
YAML

---
- hosts: all
become: yes
tasks:
- name: add tootbot user
user:
name: tootbot
create_home: yes
system: yes
- name: create tootbot folder
file:
path: /tootbot/source/
owner: tootbot
group: tootbot
mode: '0755'
state: directory
- name: update python code
copy: src={{ item.src }} dest={{ item.dest }} mode='0644'
with_items:
- { src: '../files/requirements.txt', dest: '/tootbot/source/requirements.txt' }
- { src: '../files/tootbot.py', dest: '/tootbot/source/tootbot.py' }
- name: add all template files
template: src=templates/run-bot.sh dest=/tootbot/run-bot.sh
- name: install dependencies
apt:
pkg: ['python3', 'python3-pip', 'python3-setuptools']
- name: install python requirements
raw: cd /tootbot/source/ && sudo -H -u tootbot pip3 install -r requirements.txt
args:
executable: /bin/bash
- name: chown tootbot folder
file:
path: /tootbot/
owner: tootbot
group: tootbot
state: directory
recurse: yes
- name: create tootbot crontab
cron:
name: "tootbot"
minute: "*/10"
user: tootbot
job: "/tootbot/run-bot.sh >> /tootbot/bot.log 2>&1"
disabled: no