2019-12-09 20:53:14 +00:00
|
|
|
---
|
|
|
|
- hosts: all
|
|
|
|
become: yes
|
|
|
|
|
|
|
|
tasks:
|
|
|
|
- name: add tootbot user
|
|
|
|
user:
|
|
|
|
name: tootbot
|
|
|
|
create_home: yes
|
|
|
|
system: yes
|
|
|
|
|
|
|
|
- name: create tootbot folder
|
|
|
|
file:
|
2020-09-14 11:47:36 +00:00
|
|
|
path: /tootbot/source/
|
2019-12-09 20:53:14 +00:00
|
|
|
owner: tootbot
|
|
|
|
group: tootbot
|
|
|
|
mode: '0755'
|
|
|
|
state: directory
|
|
|
|
|
2020-09-14 11:47:36 +00:00
|
|
|
- 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' }
|
|
|
|
|
2019-12-09 20:53:14 +00:00
|
|
|
- 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
|