- name: DB - Install package: name: - mariadb - python-mysqlclient - name: DB - Init command: mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql args: creates: /var/lib/mysql/ - name: Started systemd: name: mariadb enabled: yes state: started - name: DB - create user mysql_user: login_host: "{{ osp_db_host }}" name: "{{ osp_db_user }}" password: "{{ osp_db_pass }}" priv: '{{ osp_db_name }}.*:ALL,GRANT' - name: DB - create database mysql_db: login_host: "{{ osp_db_host }}" name: "{{ osp_db_name }}" encoding: utf8mb4 - name: Set DB location when: osp_db_location != "///db/database.db" set_fact: osp_db_location: "{{ osp_db_location_mysql }}"