"Q: Is there a way for me to define this as the last step?"

Ansible is order based, so if you want a task to go last, make it the very
last task in the last play in your playbook, and flush the handlers before
running it

...

- meta: flush_handlers
- shell: echo "I am the last task"

This may it will make sure any other handlers complete before running the
task.




On Thu, Aug 21, 2014 at 1:26 PM, Frank <[email protected]> wrote:

> Hi,
>
> I am writing a role to setup ‘things’ on amazon ami (redhat based I
> suppose).
>
> I have a yum upgrade step on it like so:
>
> - name: upgrade all base packages
>   yum: name=* state=latest
>
> then ‘other stuff gets done’ like installing some additional software.
>
> I want to put this next step in place to check if kernel version has
> changed or not and if so, reboot the server.
>
> - name: Check what the new version is
>   shell:  lsb_release -r | awk '{print $2}'
>   register: new_release
>
> - name: Reboot
>   command: /sbin/reboot -t now
>   when: {{ amzn_base_lsb_release }} != new_release.stdout
>
> # amzn_base_lsb_release = defined in defaults/main.yml
>
> Q: Is there a way for me to define this as the last step?
> (this is a role and this task in defined in tasks/RedHat.yml inherited by
> tasks/main.yml)
>
>
> Thanks in advance!
>
> Yes, I’m going to release this as soon as it gets right (well, its my
> first role) :)
>
> Cheers,
> Frank
>
> --
> Change is the essential process of all existence.
>
> -- Spock, "Let That Be Your Last Battlefield", stardate 5730.2
>
>  --
> 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/etPan.53f62bbf.6b8b4567.4eca%40Franciscos-MacBook-Air.local
> <https://groups.google.com/d/msgid/ansible-project/etPan.53f62bbf.6b8b4567.4eca%40Franciscos-MacBook-Air.local?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/CA%2BnsWgzV-XgW5ncBnrR0t4NB9-%3DPYvPrwwpNkmMaCacEV4fbsg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to