mirror of https://github.com/x89/Shreddit
parent
20205b4126
commit
e35a2aad10
@ -1,18 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: ro
|
|
||||||
vars:
|
|
||||||
user: napalm
|
|
||||||
install_dir: "/home/{{ user }}/Shreddit"
|
|
||||||
tasks:
|
|
||||||
- name: Update the Shreddit repository
|
|
||||||
git: repo=https://github.com/x89/Shreddit.git dest={{ install_dir }}
|
|
||||||
- name: Ensure shreddit.cfg is correct
|
|
||||||
copy: src=shreddit.cfg dest={{ install_dir }}/shreddit.cfg owner={{ user }} group={{ user }} mode=0600
|
|
||||||
- name: Ensure praw.ini is correct
|
|
||||||
copy: src=praw.ini dest={{ install_dir }}/praw.ini owner={{ user }} group={{ user }} mode=0600
|
|
||||||
- name: Run get_secret.py to check that we can login with oauth
|
|
||||||
shell: bash -c "source .venv/bin/activate && python get_secret.py" chdir={{ install_dir }}
|
|
||||||
- name: Ensure Shreddit cron job
|
|
||||||
cron: user={{ user }} name="Shreddit" minute="0" job="cd {{ install_dir }} && bash -c 'source .venv/bin/activate && python shreddit.py' 2>/dev/null"
|
|
||||||
- name: Run a test Shreddit run
|
|
||||||
shell: bash -c "source .venv/bin/activate && python shreddit.py" chdir={{ install_dir }}
|
|
@ -1,12 +0,0 @@
|
|||||||
"""This module contains the handler function called by AWS.
|
|
||||||
"""
|
|
||||||
from shreddit.shredder import shred
|
|
||||||
import yaml
|
|
||||||
|
|
||||||
|
|
||||||
def lambda_handler(event, context):
|
|
||||||
with open("shreddit.yml") as fh:
|
|
||||||
config = yaml.safe_load(fh)
|
|
||||||
if not config:
|
|
||||||
raise Exception("No config options passed!")
|
|
||||||
shred(config)
|
|
Loading…
Reference in new issue