# Action Plugins Development and handling potential

**URL:** <https://forum.ansible.com/t/action-plugins-development-and-handling-potential/36796>\
**Category:** Ansible Developer\
**Created:** [July 4, 2022, 9:41am UTC](https://forum.ansible.com/t/action-plugins-development-and-handling-potential/36796 "2022-07-04T09:41:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [July 4, 2022, 9:41am UTC](https://forum.ansible.com/t/action-plugins-development-and-handling-potential/36796/1 "2022-07-04T09:41:46Z")

</div>

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](https://gist.github.com/weiyentan/b793bddd1c949940f044f337715f6b6d)

the full block of code is here .

[apfw\_win\_update\_ansible\_collection/apfw\_wait.py at develop · weiyentan/apfw\_win\_update\_ansible\_collection (github.com)](https://github.com/weiyentan/apfw_win_update_ansible_collection/blob/develop/plugins/action/apfw_wait.py)

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.
