I try to use function "with_subelements" with module mysql_user to create an user with multiple host with a dict.
- name: "[MySQL] Check user"
mysql_user:
name: "{{ item.0.app_MySQLUser }}"
host: "{{ item.1 }}"
login_host: "{{ item.0.app_MySQLHost }}"
login_port: "{{ item.0.app_MySQLPort }}"
config_file: "{{ item.0.app_MySQLAuth }}"
password: "{{ lookup('password', 'roles/TEST/credentials/mysql.pass length=15 chars=ascii_letters,digits') }}"
update_password: on_create
priv: "{{ item.0.app_MySQLUser }}.*:ALL"
state: present
with_subelements:
- "{{ project }}"
- app_MySQLAuthorizeHostname