1

I'm using Ansistrano to deploy my Symfony2 application. Application uses Doctrine, oso I'm also using DoctrineMigrationsBundle. Now, my problem is that I would like to run database migration at the end of deployment process, but I want this operation to be called only once, and I know that ansible by default run all commands from playbook on all given servers. Is there any way to tell ansible to run a specific command on a single server from a set of all servers to which I deploy my code?

Cœur
  • 37,241
  • 25
  • 195
  • 267
pawel.kalisz
  • 1,246
  • 1
  • 18
  • 26

1 Answers1

2

There's run_once for this.

Example from the docs:

---
# ...

  tasks:

    # ...

    - command: /opt/application/upgrade_db.py
      run_once: true

    # ...
Konstantin Suvorov
  • 65,183
  • 9
  • 162
  • 193