I'm trying to use ansible and docker to take a backup of my MySQL database. This is my ansible-task:
docker_container:
name: "{{ mysql_dump_container_name }}"
image: mysql:8.0.20
env:
MYSQL_ROOT_PASSWORD: "{{ mysql_password }}"
MYSQL_DATABASE: "{{ mysql_database }}"
ports:
- "3307:3307"
volumes:
- "{{ mysql_backup_dir }}:/backup"
entrypoint: "mysqldump -u {{ mysql_username }} -p{{ mysql_password }} --host {{ mysql_host }} {{ mysql_database }} > 1.sql "
detach: yes
restart_policy: "unless-stopped"
become: yes
I am getting the following error:
mysqldump: Couldn't find table: ">"
Entrypoint message is:
"entrypoint": [
"mysqldump -u root -proot --host wl.cs.net TEST > 1.sql"
],
What am I doing wrong?