Last Updated: February 25, 2016
·
11.22K
· tartansandal

Run a local script before/after a play

You can use the script module to run a local script before/after a play.
For example,

- name: 'run local pre-deployment script'
  hosts: localhost
  tasks:
    - local_action: script files/pre-deploy.sh

- name: 'deploy website'
  hosts: webservers
  tasks:

...

- name: 'run local post-deployment script'
  hosts: localhost
  tasks:
    - local_action: script files/post-deploy.sh