Ok, thanks for the suggestion.  I've gone through a few different 
iterations of ideas and I think I'm just going to punt on the problem and 
assume we're going to be using phoenix servers most of the time.  It would 
have helped to be able to include a role and be able to pass the tagged 
tasks to run or to skip.  For example:

roles:
  - { role: myrole,      run_tags: service_restart  skip_tags: datastore }
  - { role: anotherrole, run_tags: install_configs,service_restart }
  - { role: finalrole,   skip_tags: service_restart }


That way, you can just run the playbook as is, but don't have to pass a 
whole lot of flags in from the command line which may conflict across roles 
anyways.

 Thanks,
  Trevor


On Thursday, September 11, 2014 7:27:04 AM UTC-7, Michael DeHaan wrote:
>
> Generally uninstalls aren't frequent.
>
> The reason for this is you don't know what software someone *manually* 
> installed that you don't want present.
>
> One method might be to have a list of packages in something like 
> group_vars/<groupname> called "uninstall_packages"
>
> and then just:
>
> - yum: name={{item}} state=absent
>   with_items: uninstall_packages
>
> Which would be a reasonable solution.  
>
> We do somewhat similar things in our Tower install playbooks when we no 
> longer use a particular subcomponent.
>
>
>
> On Wed, Sep 10, 2014 at 7:48 PM, Trevor G <gtr...@gmail.com <javascript:>> 
> wrote:
>
>> It's great that I can easily pull in different roles into my playbooks.  
>> By default, anything under tasks/main will get run (usually as an 
>> installation process).  I was wondering if there were any best practices 
>> for packaging a list of uninstall tasks within the role as well to undo any 
>> changes that were done in the installation process.
>>
>> One thought was to have my main task file in my role to have something 
>> like:
>>
>> ---
>> - include: install.yml
>>   when: install == "y"
>>
>> - include: uninstall.yml
>>   when: install != "y"
>>
>>
>> and by default, the install variable would be set to "y".  Then when I 
>> run the playbook, I'd use --extra-vars to set the "install" variable to "n" 
>> if I wanted to uninstall software.  The downside is that the conditional 
>> task include will dump out that the tasks that are being skipped.  This 
>> ends up cluttering the output and making things confusing, especially when 
>> there's a lot of installation and uninstall tasks.
>>
>> Another option would be to create a new role for uninstalling the 
>> software, but that is cumbersome and then requires someone to pull down two 
>> different roles and makes tasks that should be closely related much more 
>> separated and harder to manage.
>>
>> Is this the best practice for handling this use case?  Is there some sort 
>> of "include_task" type feature that would allow one to include a bunch of 
>> tasks without applying the condition to every individual task?
>>
>> Thanks,
>>   Trevor
>>
>>
>>
>>
>>  -- 
>> 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 ansible-proje...@googlegroups.com <javascript:>.
>> To post to this group, send email to ansible...@googlegroups.com 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/ansible-project/3b723b8f-87ff-4b6e-b640-b95c92611a28%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/3b723b8f-87ff-4b6e-b640-b95c92611a28%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/54fce583-cbb4-4eff-91d5-ae84b5bb8743%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to