diff --git a/roles/mariadb/defaults/main.yml b/roles/mariadb/defaults/main.yml
new file mode 100644
index 0000000000000000000000000000000000000000..d37af97ba77e5be60ab42738823002ed14b1d419
--- /dev/null
+++ b/roles/mariadb/defaults/main.yml
@@ -0,0 +1,26 @@
+---
+mariadb_skip_name_resolve: False
+mariadb_skip_networking: False
+
+mariadb_key_buffer_size: '16M'
+mariadb_max_allowed_packet: '1M'
+mariadb_table_open_cache: '64'
+mariadb_sort_buffer_size: '512K'
+mariadb_net_buffer_length: '8K'
+mariadb_read_buffer_size: '256K'
+mariadb_read_rnd_buffer_size: '512K'
+mariadb_myisam_sort_buffer_size: '8M'
+mariadb_query_cache_type: '1'
+mariadb_query_cache_limit: '16M'
+mariadb_query_cache_size: '32M'
+mariadb_max_connections: '400'
+mariadb_thread_cache_size: '16'
+
+mariadb_innodb_data_file_path: 'ibdata1:10M:autoextend'
+mariadb_innodb_buffer_pool_size: '16M'
+mariadb_innodb_log_file_size: '5M'
+mariadb_innodb_log_buffer_size: '8M'
+mariadb_innodb_flush_log_at_trx_commit: '1'
+mariadb_innodb_stats_sample_pages: '32'
+mariadb_innodb_thread_concurrency: '8'
+mariadb_innodb_file_per_table: False
diff --git a/roles/mariadb/handlers/main.yml b/roles/mariadb/handlers/main.yml
new file mode 100644
index 0000000000000000000000000000000000000000..6f737d9130d2de8b1d277cf2f284a0777a333d2a
--- /dev/null
+++ b/roles/mariadb/handlers/main.yml
@@ -0,0 +1,3 @@
+---
+- name: restart mariadb
+  service: name=mariadb state=restarted
diff --git a/roles/mariadb/tasks/main.yml b/roles/mariadb/tasks/main.yml
new file mode 100644
index 0000000000000000000000000000000000000000..5e3dca4acb12c5b1e675f04b312cd9cc4f9d19e6
--- /dev/null
+++ b/roles/mariadb/tasks/main.yml
@@ -0,0 +1,38 @@
+---
+- name: install mariadb
+  pacman: name=mariadb,mysql-python state=present
+
+- name: initialize mariadb
+  command: mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
+  args:
+    creates: /var/lib/mysql/mysql
+
+- name: start and enable the service
+  service: name=mariadb state=running enabled=yes
+
+- name: delete anonymous users
+  mysql_user: user='' host_all=yes state='absent'
+
+- name: disallow remote root login
+  command: 'mysql -NBe "{{ item }}"'
+  with_items:
+    - DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')
+  changed_when: false
+
+- name: drop test database
+  mysql_db: db=test state=absent
+
+- name: set root password
+  mysql_user: user=root host={{ item }} password={{ mariadb_users.root }}
+  with_items:
+    - '127.0.0.1'
+    - '::1'
+    - 'localhost'
+
+- name: create client configuration for root
+  template: src=client.cnf.j2 dest=/root/.my.cnf
+
+- name: configure mariadb
+  template: src=server.cnf.j2 dest=/etc/mysql/my.cnf
+  notify:
+    - restart mariadb
diff --git a/roles/mariadb/templates/client.cnf.j2 b/roles/mariadb/templates/client.cnf.j2
new file mode 100644
index 0000000000000000000000000000000000000000..8faf567c5e2263ffab3f94f8cc62831cb5c071da
--- /dev/null
+++ b/roles/mariadb/templates/client.cnf.j2
@@ -0,0 +1,3 @@
+[client]
+user=root
+password={{ mariadb_users.root }}
diff --git a/roles/mariadb/templates/server.cnf.j2 b/roles/mariadb/templates/server.cnf.j2
new file mode 100644
index 0000000000000000000000000000000000000000..98b3199db30b47782c818dc7f22609a9c7898ecf
--- /dev/null
+++ b/roles/mariadb/templates/server.cnf.j2
@@ -0,0 +1,61 @@
+[client]
+port            = 3306
+socket          = /run/mysqld/mysqld.sock
+
+[mysqld]
+port            = 3306
+socket          = /run/mysqld/mysqld.sock
+skip-external-locking
+{% if mariadb_skip_name_resolve %}
+skip-name-resolve
+{% endif %}
+{% if mariadb_skip_networking %}
+skip-networking
+{% endif %}
+
+# Memory settings
+key_buffer_size = {{ mariadb_key_buffer_size }}
+max_allowed_packet = {{ mariadb_max_allowed_packet }}
+table_open_cache = {{ mariadb_table_open_cache }}
+sort_buffer_size = {{ mariadb_sort_buffer_size }}
+net_buffer_length = {{ mariadb_net_buffer_length }}
+read_buffer_size = {{ mariadb_read_buffer_size }}
+read_rnd_buffer_size = {{ mariadb_read_rnd_buffer_size }}
+myisam_sort_buffer_size = {{ mariadb_myisam_sort_buffer_size }}
+query_cache_type = {{ mariadb_query_cache_type }}
+query_cache_limit = {{ mariadb_query_cache_limit }}
+query_cache_size = {{ mariadb_query_cache_size }}
+max_connections = {{ mariadb_max_connections }}
+thread_cache_size = {{ mariadb_thread_cache_size }}
+
+# Single server setup
+server-id       = 1
+innodb_support_xa = 0
+
+# InnoDB settings
+innodb_data_file_path = {{ mariadb_innodb_data_file_path }}
+innodb_buffer_pool_size = {{ mariadb_innodb_buffer_pool_size }}
+innodb_log_file_size = {{ mariadb_innodb_log_file_size }}
+innodb_log_buffer_size = {{ mariadb_innodb_log_buffer_size }}
+innodb_flush_log_at_trx_commit = {{ mariadb_innodb_flush_log_at_trx_commit }}
+innodb_stats_sample_pages = {{ mariadb_innodb_stats_sample_pages }}
+innodb_thread_concurrency = {{ mariadb_innodb_thread_concurrency }}
+{% if mariadb_innodb_file_per_table %}
+innodb_file_per_table
+{% endif %}
+
+[mysqldump]
+quick
+max_allowed_packet = 16M
+
+[mysql]
+no-auto-rehash
+
+[myisamchk]
+key_buffer_size = 20M
+sort_buffer_size = 20M
+read_buffer = 2M
+write_buffer = 2M
+
+[mysqlhotcopy]
+interactive-timeout