Ansible Wordpress Error

I want to setup WordPress[enter image description here][1] using Ansible environment. When i run following YAML files, it gives following error

Connection refused

Error establishing a database connection

wordpressweb.yaml

- hosts: wordpressweb
remote_user: ubuntu
become: yes
become_user: root
become_method: sudo

tasks:
- name: apache must be installed
apt:
name: apache2
state: latest
update_cache: yes
- name: php must be installed
apt:
name: libapache2-mod-php
state: latest
update_cache: yes
- name: mysql mod must be installed
apt:
name: php-mysql
state: latest
update_cache: yes
- name: apache must be running
service:
enabled: yes
name: apache2
state: started
- name: apache must be restarted
service:
enabled: yes
name: apache2
state: restarted
- name: Make sure that there is no index.html
file:
path: /var/www/html/index.html
state: absent
- name: Download wordpress files and extract them to /var/www/html
unarchive:
dest: /var/www/html
remote_src: yes
src: https://wordpress.org/latest.tar.gz
- name: Copy wp-config.php with correct credentials to /var/www/html
copy:
dest: /var/www/html/wordpress/wp-config.php
src: /home/ansible/.ansible/wp-config.php

wordpressdb.yaml

- hosts: wordpressdb
remote_user: ubuntu
become: yes
become_user: root
become_method: sudo
tasks:
- name: Make sure that mysql is installed
apt:
name: mysql-server
update_cache: yes
state: latest
- name: Make sure that Mysql is up and running , also enabled at boot
service:
name: mysql
enabled: yes
state: started
- name: Make sure that Pymysql installed
apt:
name:
- python3-pymysql
update_cache: yes
state: latest
- name: Make sure that database wpdb exsists
mysql_db:
name: wpdb
state: present
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Make sure that database user wpuser exists and he has permissions to the wpdb database
mysql_user:
name: wpuser
password: DEVOPS12345
priv: wpdb.*:ALL
login_unix_socket: /var/run/mysqld/mysqld.sock
- name: Make sure that database user wpuser exists and he has permissions to the wpdb database
mysql_user:
name: wpuser
password: DEVOPS12345
priv: wpdb.*:ALL
host_all: yes
login_unix_socket: /var/run/mysqld/mysqld.sock