I would recommend to not use tag for conditional execution of part of a
play/playbook
Just A personal preference

Phil

2017-04-19 11:34 GMT+02:00 fanvalt <[email protected]>:

> instead of tagging --tags "restore" when I want to restore, I guess the
> way to proceed is to use --skip-tags "restore" if I don't want to restore
>
>
> Le mercredi 19 avril 2017 11:29:07 UTC+2, fanvalt a écrit :
>>
>> Thank you, finally i cannot figure out how to work on my playbook.
>>
>> I have a main.yml with some includes, some are tags to skip them with the
>> --skip-tags option.
>>
>> main.yml:
>>
>>   - include: existence.yml
>> ...
>>   - include: installation.yml
>>     tags:
>>       - installation
>> ...
>>   - include: demarrage_karaf.yml
>>
>>
>> so if I use --skip-tags "installation", this will only restart the karaf
>> instance.
>> If I don't use any tags, the installation will be done and karaf will be
>> restarted
>>
>> What I want is to add a restore option (tags) so if installation or any
>> tasks failed, I can restore the old installation and restart karaf.
>>
>>
>> I thought adding the main in a block rescue this way would work:
>>
>> block:
>>   - include: existence.yml
>> ...
>>   - include: installation.yml
>>     tags:
>>       - installation
>> ...
>>   - include: demarrage_karaf.yml
>>
>> rescue:
>>     - include: failure.yml
>>       tags:
>>         - restore
>>
>> but if I run the playbook with only the --tags "restore" , it won't run
>> any tasks not tagged or the include tagged with the "installation" tags.
>> Shall I tag all tasks with "always" tag ?
>> Is there another way to proceed than using a restore tag ?
>>
>> Regards,
>>
>>
>> Le jeudi 13 avril 2017 16:21:34 UTC+2, Brian Coca a écrit :
>>>
>>> You can tag the whole block or individual tasks within the block,
>>> there is no way to only tag the rescue/always part of a block.
>>>
>>> ----------
>>> Brian Coca
>>>
>> --
> 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/1da6358a-3130-4070-9c32-d52a328d362a%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/1da6358a-3130-4070-9c32-d52a328d362a%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 [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/CAB1FMuS39EWekC6NwUN3LtVKoMQ-A-_UQfO4g0CLHz05UohSzg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to