Deploy flask application

How to deploy python-flask application using ansible?

How do you deploy it now (without ansible)?

How to deploy python-flask application using ansible?

There are many ways to do it. First you have to define the steps. Then use Ansible to carry out those steps or tasks.

Here's how I do it. I have written a generic role to deploy Flask apps. I have a playbook that executes the role.

1. Check out the Git repository to a source directory

2. Copy the source files to destination directory

3. Update/install Python packages in the virtual environment

4. Run DB migrations

5. Run some CLI commands

6. Restart systemd units

Take a look at this already available role - https://github.com/vitalk/ansible-flaskapp. You might want to change as per your environment.