--- - name: Installation des paquets python-mysqldb mariadb-server apt: name: - python-mysqldb - mariadb-server state: present - name: Create mysql database mysql_db: name: "{{ maria_dbname }}" state: present login_unix_socket: /var/run/mysqld_mysqld.sock - name: Creation de l'utilisateur mysql avec tous les privileges mysql_user: name: "{{ maria_dbuser }}" password: "{{ maria_dbpasswd }}" priv: "*.*:ALL,GRANT" login_unix_socket: /var/run/mysqld/mysqld.sock with_items: - 127.0.0.1 - name: Copie du fichier my.cnf pour autorises toutes les adresses sur le port 3306 copy : src=my.cnf dest=/etc/mysql/ - name: Redemarrage du service mariadb shell: service mariadb restart