I have written one ansible playbook for installing MySQL server in ubuntu remote machine but is not working here is the yaml code
--- - name: setting mysql in ubuntu hosts: web01 become: yes tasks: - name: install mysql apt: name: mysql-server state: present - name: install python apt: name: python3-pymysql state: present - name: start & enable server service: name: mysql state: started enabled: yes - name: user setup in mysql mysql_user: check_implicit_admin: true login_user: root login_password: password user: root password: password host: web01 priv: '*.*.:ALL,GRANT' - name: create db mysql_db: name: db state: present everytime in user setup it is showing:
fatal: [web01]: FAILED! => {"changed": false, "msg": "unable to connect to database, check login_user and login_******** are correct or /root/.my.cnf has the credentials. Exception message: (1698, "Access denied for user 'root'@'localhost'")"}
the web01 is the ec2 server name in aws I have also configured the inventory file properly and check it using ad-hoc command -m ping
and I have also made .my.cnf in the path /root/.my.cnf in the target machine and I have entered it like:
[client] user=root password=password