On 10.01.2017 15:04, Pieter Voet wrote:
Hi all,

if any play in a playbook actually changes something, I want to display a
'please restart something' message to the playbook user.
Is there a way to get the 'PLAY RECAP' changed  variable value from a
playbook ?

I think the only way is to write you own callback plugin.


something like this pseudo playbook:

---
- hosts: all
  tasks:
  - name: Do something
    shell: doit.sh

  - debug: msg="Please restart server to effectuate changes..."
    when: play_recap | Changed


I don't want a restart to get initiated from the playbook. The playbook
should be used to possibly make a configuration change,
and when it did change something, the user should be notified to schedule
the required restart later..

You could use a handler like so

---
- hosts: all
  tasks:
  - name: Do something
    shell: doit.sh
    notify: Inform user to reboot

  handlers:
  - name: Inform user to reboot
    debug: msg="Please restart server to effectuate changes..."

--
Kai Stian Olstad

--
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/354dc6ff37dfebee9a96d3a092eabea3%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to