Cancel operation when performing apt upgrade

Hi,

I’m very in IT orchestration and my new mission is to deploy new servers with Ansible.

My questions are :

  • How can i handle an apt safe upgrade error ?
  • How can script in my playbook “Don’t upgrade if apt encounts error”

What i mean is :
Many of how servers are old and not upgraded.
I’m a little chilly because i’ve already been confronted to error when i performed aptitude safe-upgrade in a single server and i don’t want all my servers to be down :frowning:

Many Thanks

Nhat