diff --git a/roles/wallabag/tasks/wallabag.yml b/roles/wallabag/tasks/wallabag.yml index 1c2ded7..c424b0a 100644 --- a/roles/wallabag/tasks/wallabag.yml +++ b/roles/wallabag/tasks/wallabag.yml @@ -21,22 +21,16 @@ - php5-pgsql - php5-tidy -- name: Create database user for wallabag - postgresql_user: login_host=localhost - login_user={{ db_admin_username }} - login_password="{{ db_admin_password }}" - name={{ wallabag_db_username }} - password="{{ wallabag_db_password }}" - state=present +#- name: Import database user template +# template: src=root-wallabag.sql.j2 dest=/root/wallabag.sql +# +#- name: Import sql file for account and db creation +# shell: mysql < /root/wallabag.sql -- name: Create database for wallabag - postgresql_db: login_host=localhost - login_user={{ db_admin_username }} - login_password="{{ db_admin_password }}" - name={{ wallabag_db_database }} - state=present - owner={{ wallabag_db_username }} - notify: import wallabag sql + +- name: Import wallabag sql + shell: mysql {{ wallabag_db_database }} < /var/www/wallabag/install/mysql.sql + notify: remove install folder - name: Build Composer shell: curl -sS https://getcomposer.org/installer | php diff --git a/roles/wallabag/templates/root-wallabag.sql.j2 b/roles/wallabag/templates/root-wallabag.sql.j2 new file mode 100644 index 0000000..3091d88 --- /dev/null +++ b/roles/wallabag/templates/root-wallabag.sql.j2 @@ -0,0 +1,5 @@ +CREATE USER 'wallabag'@'localhost' IDENTIFIED BY '{{ wallabag_db_password }}'; +GRANT USAGE ON * . * TO 'wallabag'@'localhost' IDENTIFIED BY '{{ wallabag_db_password }}' WITH MAX_QUERIES_PER_HOUR 0 +MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ; +CREATE DATABASE IF NOT EXISTS `wallabag` ; +GRANT ALL PRIVILEGES ON `wallabag` . * TO 'wallabag'@'localhost';