ansible-nginx-uwsgi-supervisor/pre_deployment/mysql_db.yaml

24 lines
594 B
YAML

---
- hosts: all
sudo: yes
vars:
databases:
rookeries:
username: rookeries
password: system_admin
tasks:
- name: Setup MySQL 5 server + Python dependencies
apt: pkg={{ item }} state=present
with_items:
- mysql-server
- python-mysqldb
- name: Setup MySQL databases for rookeries.
mysql_db: name={{ item.key }} state=present
with_dict: databases
- name: Setup MySQL database users for rookeries.
mysql_user: name={{ item.value.username }} password={{ item.value.password }} priv={{ item.key }}:ALL
with_dict: databases