Set MySQL's root password using Ansible's debconf module:
vars: mysql_root_pass: yourRootPassword tasks: - name: Set MySQL root password before installing debconf: name='mysql-server' question='mysql-server/root_password' value='{{mysql_root_pass | quote}}' vtype='password' - name: Confirm MySQL root password before installing debconf: name='mysql-server' question='mysql-server/root_password_again' value='{{mysql_root_pass | quote}}' vtype='password'
Set MySQL's root password using Ansible's debconf module: