Moved ansible config into this repo, manage passwords with ansible
This commit is contained in:
parent
2bbdfede11
commit
48d8308049
8 changed files with 96 additions and 14 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,3 +1 @@
|
||||||
*.secret
|
inventory
|
||||||
cron.sh
|
|
||||||
|
|
||||||
|
|
5
ansible.cfg
Normal file
5
ansible.cfg
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
[defaults]
|
||||||
|
inventory=inventory
|
||||||
|
|
||||||
|
[ssh_connection]
|
||||||
|
pipelining = True
|
|
@ -1,11 +0,0 @@
|
||||||
# activate virtualenv if necessary
|
|
||||||
# source /home/cquest/.virtualenvs/tootbot/bin/activate
|
|
||||||
|
|
||||||
# parameters:
|
|
||||||
# 1- twitter account to clone
|
|
||||||
# 2- mastodon login
|
|
||||||
# 3- mastodon password
|
|
||||||
# 4- instance domain (https:// is automatically added)
|
|
||||||
|
|
||||||
python tootbot.py geonym_fr geonym@amicale.net **password** test.amicale.net
|
|
||||||
python tootbot.py cq94 cquest@amicale.net **password** test.amicale.net
|
|
5
inventory.example
Executable file
5
inventory.example
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
[tootbot]
|
||||||
|
user@host newsbots_password=my_password
|
||||||
|
|
||||||
|
[all:vars]
|
||||||
|
ansible_connection=ssh
|
34
templates/run-bot.sh
Executable file
34
templates/run-bot.sh
Executable file
|
@ -0,0 +1,34 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# parameters:
|
||||||
|
# 1- twitter account to clone
|
||||||
|
# 2- mastodon login
|
||||||
|
# 3- mastodon password
|
||||||
|
# 4- instance domain (https:// is automatically added)
|
||||||
|
|
||||||
|
PATH="/app/tootbot"
|
||||||
|
|
||||||
|
cd "$PATH/telesur_en"
|
||||||
|
../source/tootbot.py telesurenglish me+telesur_en@nutomic.com {{ newsbots_password }} newsbots.eu &>> bot.log &
|
||||||
|
/bin/sleep 60
|
||||||
|
|
||||||
|
cd "$PATH/telesur_es"
|
||||||
|
../source/tootbot.py teleSURtv me+telesur_es@nutomic.com {{ newsbots_password }} newsbots.eu &>> bot.log &
|
||||||
|
/bin/sleep 60
|
||||||
|
|
||||||
|
cd "$PATH/itsgoingdown"
|
||||||
|
../source/tootbot.py IGD_News me+itsgoingdown@nutomic.com {{ newsbots_password }} newsbots.eu &>> bot.log &
|
||||||
|
/bin/sleep 60
|
||||||
|
|
||||||
|
cd "$PATH/postillon"
|
||||||
|
../source/tootbot.py Der_Postillon me+postillon@nutomic.com {{ newsbots_password }} newsbots.eu &>> bot.log &
|
||||||
|
/bin/sleep 60
|
||||||
|
|
||||||
|
cd "$PATH/telepolis"
|
||||||
|
../source/tootbot.py telepolis_news me+telepolis@nutomic.com {{ newsbots_password }} newsbots.eu &>> bot.log &
|
||||||
|
/bin/sleep 60
|
||||||
|
|
||||||
|
cd "$PATH/granma"
|
||||||
|
../source/tootbot.py Granma_English me+granma@nutomic.com {{ newsbots_password }} newsbots.eu &>> bot.log &
|
||||||
|
/bin/sleep 60
|
51
tootbot.yml
Normal file
51
tootbot.yml
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
become: yes
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: add tootbot user
|
||||||
|
user:
|
||||||
|
name: tootbot
|
||||||
|
create_home: yes
|
||||||
|
system: yes
|
||||||
|
|
||||||
|
- name: create tootbot folder
|
||||||
|
file:
|
||||||
|
path: /tootbot/
|
||||||
|
owner: tootbot
|
||||||
|
group: tootbot
|
||||||
|
mode: '0755'
|
||||||
|
state: directory
|
||||||
|
|
||||||
|
- 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: clone/update git repo
|
||||||
|
git:
|
||||||
|
repo: 'https://github.com/Nutomic/tootbot.git'
|
||||||
|
dest: /tootbot/source/
|
||||||
|
|
||||||
|
- 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
|
Loading…
Reference in a new issue