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

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/809814ed-26ed-498a-8df0-08fbc25e0de0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to