I am exploring writing Action Plugins.
What I am writing is a custom action plugin that runs a ‘compliance’ module on the destination Windowd host to determine whether a certain task has been completed or not. The reason why I have it in an action plugin and not a module is that the destination host may reboot and if it reboots then the module will break. I have a timeout feature.
Anyway I was wondering how to handle when the server reboots, and the action plugin is running the self.execute_module there will be a connection error.
I am accounting for a AnsibleConnectionFailure error.
The gist for it is here
https://gist.github.com/weiyentan/b793bddd1c949940f044f337715f6b6d
the full block of code is here .
Is this the right way to handle it?
Many thanks for any guidance.
Its my first time giving this a go and I am learning a lot along the way.