--- - name: install mariadb apt: pkg: - mariadb-server - python-mysqldb - name: create mariadb dbs mysql_db: name: "{{ item.key }}" collation: "{{ item.value.collation | default('utf8_general_ci') }}" encoding: "{{ item.value.encoding | default('utf8') }}" with_dict: "{{ mariadb.dbs }}" - name: create mariadb users mysql_user: name: "{{ item.key }}" host: "{{ item.value.host | default('localhost') }}" password: "{{ item.value.password }}" priv: "{{ item.value.priv | default('*.*:USAGE') }}" with_dict: "{{ mariadb.users }}"