You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Shreddit/helpers/ansible-shreddit.yml

19 lines
993 B

---
- 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 }}