--- # Needs variables: # - site: dict describing the site install (cf group_vars/all/vars.yml) - name: "Create database {{ site.mysql_database }} if inexistent" # mysql_db: # name: "{{ site.mysql_database }}" # state: present # # Credentials to log in MySQL # login_host: localhost # login_user: root # login_password: "{{ mysql_root_password }}" # MySQL equivalent: # TODO: PostgreSQL? # create user @ identified by ; # grant all on .* to @; - name: "Add database user {{ site.mysql_username }}@{{ site.subnet_site_ip }} and grant all privileges on {{ site.mysql_database }}" # mysql_user: # # Credentials to log in MySQL # login_host: localhost # login_user: root # login_password: "{{ mysql_root_password }}" # # Credentials of the new db user # host: "{{ site.subnet_site_ip }}" # name: "{{ site.mysql_username }}" # password: "{{ site.mysql_password }}" # # Grants # priv: "{{ site.mysql_database }}.*:all" # state: present