Hello
I just encountered a special use case of the module 'pause' that seems
strange to me.
It seems that this module is executed *only for the first host of the
playbook*.
I woul'd like to run a pause task inside a block.
*Example :*
- block:
# Arrêt de MDM
- name: "{{ playbook_name }} - arret du service
RTU_JBOSSMDM_SANS_NETRICS"
win_service:
name: "RTU_JBOSSMDM_SANS_NETRICS"
state: "stopped"
# Pause de 40 secondes pour laisser le temps au service de s'arrêter
- name: "{{ playbook_name }} - attente de 40s"
pause:
seconds: "40"
# Démarrage de MDM
- name: "{{ playbook_name }} - arret du service
RTU_JBOSSMDM_SANS_NETRICS"
win_service:
name: "RTU_JBOSSMDM_SANS_NETRICS"
state: "started"
# Pause de 180 secondes pour laisser le temps au service de démarrer
- name: "{{ playbook_name }} - attente de 180s"
pause:
seconds: "180"
when: (cluster == "non" or (cluster == "oui" and
win_stat_disque_f_result.stat.exists == True))
The big problem is : if the condition of the block causes the *first host
to be excluded from the block, the pause task within this block will not be
executed*.
I solved the problem by removing the block and putting the 'when' condition
on each task (except for the pause task).
It works but it seems not very clean to me.
*Example :*
# Arrêt de MDM
- name: "{{ playbook_name }} - arret du service
RTU_JBOSSMDM_SANS_NETRICS"
win_service:
name: "RTU_JBOSSMDM_SANS_NETRICS"
state: "stopped"
when: (cluster == "non" or (cluster == "oui" and
win_stat_disque_f_result.stat.exists == True))
# Pause de 40 secondes pour laisser le temps au service de s'arrêter
- name: "{{ playbook_name }} - attente de 40s"
pause:
seconds: "40"
# Démarrage de MDM
- name: "{{ playbook_name }} - arret du service
RTU_JBOSSMDM_SANS_NETRICS"
win_service:
name: "RTU_JBOSSMDM_SANS_NETRICS"
state: "started"
when: (cluster == "non" or (cluster == "oui" and
win_stat_disque_f_result.stat.exists == True))
# Pause de 180 secondes pour laisser le temps au service de démarrer
- name: "{{ playbook_name }} - attente de 180s"
pause:
seconds: "180"
Regards,
Fabrice Perko
--
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/581b37dc-3d27-421e-8470-817eca218899%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.