To run it:
ansible-playbook “myplaybookname.yaml” -i ./hosts -e “mysql_root_password=……” -e “mysql_database=…”

- name: create new mysql database
  hosts: newinstance
  gather_facts: no

  tasks:
  - name: show hosts
    debug: msg="play_hosts={{play_hosts}}"
    
  - name: create database
    mysql_db:
      login_user: root
      login_password: "{{ mysql_root_password }}"
      name: "{{mysql_database}}"
      collation: utf8_unicode_ci
      encoding: utf8
      state: present