apenella / go-ansible

Go-ansible is a Go package that enables the execution of ansible-playbook or ansible commands directly from Golang applications. It supports a wide range of options for each command, enabling smooth integration of Ansible functionality into your projects.
MIT License
905 stars 143 forks source link

Inquiry about Referencing Executed Processes in DefaultExecute Object #150

Closed chungeun-choi closed 6 months ago

chungeun-choi commented 6 months ago

Hello,

I have a question regarding the DefaultExecute object. Is there a property that allows us to reference the process that has been executed? We are looking for a variable that can track the Ansible tasks executed to ensure they are properly monitored.

Thank you.

apenella commented 6 months ago

hi @chungeun-choi! Thank you for your question. Unfortunately, at this moment, it is not possible to grab the ID of the spawned process. The Cmd is instantiated inside the Execute method of the DefaultExecutor and is not accessible from outside.

One solution that comes to mind is to create an Executor inspired by DefaultExecutor, where you can have more control over the Cmd.

I will consider if it is possible to achieve this while maintaining an agnostic Executable within the DefaultExecutor.

chungeun-choi commented 6 months ago

Hi @apenella , Thank you for your response. I will proceed with developing a custom Executor object.