LOC-18 Deploy server with ansible
LOC-18 Deploy server with ansible

It could do with some tidying and some conditionals, but it's now possible to deploy the server with the ansible playbook.

file:b/ansible/README.md (new)
  LocalChat Ansible Playbook Instructions
  =========================================
 
 
 
  Dependancies
  ----------------
 
  Requires ansible >= 2.2
ansible_user: ansible ansible_user: ansible
  ansible_become: true
   
  192.168.7.253
 
localchat_server_install_path: /usr/local/localchat localchat_server_install_path: /usr/local/src/localchat
  localchat_server_install_ver: 0.0.2.1
   
   
--- ---
   
# Handlers # Handlers
   
   
   
- name: Start service - name: Start service
# See above. # See above.
command: systemctl start localchat.service command: systemctl start localchat.service
become: true  
   
- name: reload systemd - name: reload systemd
command: systemctl daemon-reload command: systemctl daemon-reload
become: true  
   
   
--- ---
   
- name: Install Dependancies - name: Install Utils
apt: name={{item}} state=installed apt: name={{item}} state=installed
with_items: with_items:
- python-flask - python-pip
- python-urllib3  
- python-sqlite - python-sqlite
- python-bcrypt - unzip
- python-gnupg  
become: true  
tags: deps tags: deps
   
  - name: Install Python Dependancies
  pip: name={{item}} state=present
  with_items:
  - flask
  - werkzeug
  - bcrypt
  - gnupg
  - pyopenssl
  tags: deps
   
   
  - name: Create install dir
  file: path={{localchat_server_install_path}} state=directory
   
  - name: Download and install Server
  unarchive:
  src: "https://github.com/bentasker/LocalChat/archive/v{{localchat_server_install_ver}}.zip"
  dest: "{{localchat_server_install_path}}"
  remote_src: yes
   
  - name: Symlink latest
  file:
  src: "{{localchat_server_install_path}}/LocalChat-{{localchat_server_install_ver}}/server/LocalChat.py"
  dest: "{{localchat_server_install_path}}/LocalChat.py"
  state: link
  - name: Create Unit File
  template: src=localchat.service dest=/etc/systemd/system/localchat.service
  notify: reload systemd
   
   
   
   
   
   
- name: Create Unit File  
template: src=localchat.service dest=/etc/systemd/system/localchat.service  
notify: reload systemd  
become: true  
   
  - name: Start server
  command: systemctl start localchat