i write one specific roles for local and dev environment that will drop and recreate the database from first server in dbserver group which mostly used as the master databas
If you need to delegate your task to the first server only and run it once no matter how many servers in the current play, use:
- name: drop database mysql_db: name={{ targetdbname }} state=absent when: targetdeploydb == "new" delegate_to: "{{ groups['dbserver'] | first }}" run_once: true