Open
Conversation
jake-scott
reviewed
Jun 25, 2020
plugins/callback/terraform_stream.py
Outdated
|
|
||
|
|
||
| def sample_server(display_self): | ||
| server_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) |
There was a problem hiding this comment.
We might be able to do this without explicit configuration. If you bind to any available port on the local host here, you can then pass the port you get, to the code that writes. I believe that binding to port 0 will give you an 'available' port, which you can find with a getsockname() call. I think you can use INADDR_ANY for the hostname in the socket bind, to bind to all local addresses. The writer then just has to send to the IP of the controller which you should be able to find in code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
Whenever one runs a terraform apply or destroy command, one does not get a real time feedback as to what is happening at the background . So the terraform module has been modified and a customized plugin called terraform_stream has been added to the module to enable one to get a realtime output when one runs a terraform apply or destroy.
ISSUE TYPE
COMPONENT NAME
terraform module
terraform_stream plugin
ADDITIONAL INFORMATION
On start of the playbook, the callback plugin starts a daemonized UDP socket server and then the terraform tasks would then execute and send output to the plugin.
The callback plugin reads the socket port and host from an environment variable
ANSIBLE_TERRAFORM_STREAM_PORT={port number}ANSIBLE_TERRAFORM_STREAM_HOST={ip of the control node}playbook.yml
ansible.cfg