###############################################################################
#  Configures TiddlyWeb
#
###############################################################################
---

- name: Update APT cache
  action: apt update_cache=true

- name: Install dependencies for Python (installs easy_install)
  action: apt pkg={{ item }} force=yes state=present
  with_items: 
    - python-dev
    - python-setuptools

- name: Install pip
  action: easy_install name=pip

- name: Install virtualenv module 
  action: pip name=virtualenv state=latest 

- name: Install tiddlywebwiki module
  action: pip name=tiddlywebwiki state=latest

- name: Create tiddlyweb instance
  action: command twinstance {{ tw_instance }}
          chdir=/root
          creates=/root/{{ tw_instance }}

- name: Copy tiddlweb configuration file
  action: copy src=tiddlywebconfig.py dest=/root/{{ tw_instance }}/ mode=0655

- name: Start tiddlyweb instance server
  action: command twanager server 
          chdir=/root/{{ tw_instance }}
