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