---
# mysql
- name: create hutmap databases for mysql
  mysql_db:
    name=$item
    state=present
  with_items:
    - ${hutmap.db_name}
    - test_${hutmap.db_name}

- name: create hutmap user for mysql
  mysql_user: 
    name=${hutmap.db_user}
    password=${hutmap.db_password}
    host='%'
    priv=${hutmap.db_name}.*:ALL/test_${hutmap.db_name}.*:ALL
    state=present

# packages needed by python requirements
- name: update apt
  apt: update_cache=yes

- name: install pip
  apt: pkg=python-pip state=latest

- name: install virtualenv
  pip: name=virtualenv

- name: install packages needed by mysql-python
  apt: pkg=$item state=installed
  with_items:
    - libmysqlclient-dev
    - python-dev

- name: install packages needed by pil
  apt: pkg=$item state=installed
  with_items:
    - libjpeg-dev
    - libfreetype6-dev 
    - zlib1g-dev

- name: symlink libraries to /usr/lib
  command: ln -s /usr/lib/${ansible_architecture}-linux-gnu/$item /usr/lib/
    creates=/usr/lib/$item
  with_items:
    - libfreetype.so
    - libjpeg.so
    - libz.so


---
# mysql
- name: create hutmap databases for mysql
  mysql_db:
    name=$item
    state=present
    encoding=utf8
  with_items:
    - ${hutmap.db_name}
    - test_${hutmap.db_name}

- name: create hutmap user for mysql
  mysql_user: 
    name=${hutmap.db_user}
    password=${hutmap.db_password}
    host='%'
    priv=${hutmap.db_name}.*:ALL/test_${hutmap.db_name}.*:ALL
    state=present

# packages needed by python requirements
- name: update apt
  apt: update_cache=yes

- name: install pip
  apt: pkg=python-pip state=latest

- name: install virtualenv
  pip: name=virtualenv

- name: install packages needed by mysql-python
  apt: pkg=$item state=installed
  with_items:
    - libmysqlclient-dev
    - python-dev

- name: install packages needed by pil
  apt: pkg=$item state=installed
  with_items:
    - libjpeg-dev
    - libfreetype6-dev 
    - zlib1g-dev

- name: symlink libraries to /usr/lib
  command: ln -s /usr/lib/${ansible_architecture}-linux-gnu/$item /usr/lib/
    creates=/usr/lib/$item
  with_items:
    - libfreetype.so
    - libjpeg.so
    - libz.so


Make sure tables have utf8 encoding.
Make sure tables have utf8 encoding.
