Hi@akhtar,
You can use docker_container module in your Ansible playbook to launch MySQL container. I have attached one playbook below for your reference.
vars:
docker_volume: db_data
docker_network: ansible_net
db_name: db
- name: "Launch database container"
docker_container:
name: "{{ db_name }}"
image: mysql:5.7
volumes:
- "{{ docker_volume }}:/var/lib/mysql:rw"
restart: true
networks:
- name: "{{ docker_network }}"
alias:
- "{{ db_name }}"
env:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress