Let's say I need to deploy two sets of applications - PHP vs PERL.
I want to be able to re-use the pre_tasks and post_tasks snippet so that i dont have to make changes to multiple scripts if I modify a value for the netscaler module. I guess my question is what's the point of using "pre_tasks" and "post_tasks" if I can put them inside a role as dependencies?
See below for original script. I would essentially do the same thing for my perl deploys. I would like to throw the "pre_tasks" and "post_tasks" into one file and call them when I need to. What's the best way to handle that?
- hosts: webservers
gather_facts: no
vars_files:
- "group_vars/deploy_list_sam"
serial: 3
vars:
type: service
name: "https.svc.{{ inventory_hostname }}.{{ environment_id }}"
pre_tasks:
- name: disable service in the lb
netscaler: nsc_host={{nsc_host}} user={{nsc_user}} password={{nsc_pass}} name={{name}} type={{type}} action=disable validate_certs=no
delegate_to: 127.0.0.1
tags: ns_remove_web
roles:
- web
post_tasks:
- name: enable in the lb
netscaler: nsc_host={{nsc_host}} user={{nsc_user}} password={{nsc_pass}} name={{name}} type={{type}} action=enable validate_certs=no
delegate_to: 127.0.0.1
tags: ns_add_web