mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 03:11:24 -07:00
wait_for_connection: Wait for system to become reachable (#20011)
* WIP: wait_for_connection: Wait for system to be reachable This action plugin allows to check when a system is back online and usable by Ansible. As an example, when doing a SysPrep and running Enable-WinRM.ps1, it takes between 10 to 20 seconds between the WinRM TCP port to open, and it actually being able to server Ansible requests. This time is variable and depends on the boot process. Current implementation is specific for Windows (WinRM) only, this will be fixed shortly. This fixes #19998 * Support other transport types * Various improvements - Fix reported typo - Add transport_test support in accelerate plugin - Ensure port is an integer * Improve examples * Small fixes - Use correct ConfigureRemotingForAnsible.ps1 script name - Only use win_ping when remote shell is known to be Powershell - Add integration tests to CI framework
This commit is contained in:
parent
0bd2714122
commit
52959ebdc1
9 changed files with 270 additions and 1 deletions
|
@ -133,6 +133,14 @@ class Connection(ConnectionBase):
|
|||
|
||||
transport = 'paramiko'
|
||||
|
||||
def transport_test(self, connect_timeout):
|
||||
''' Test the transport mechanism, if available '''
|
||||
host = self._play_context.remote_addr
|
||||
port = int(self._play_context.port or 22)
|
||||
display.vvv("attempting transport test to %s:%s" % (host, port))
|
||||
sock = socket.create_connection((host, port), connect_timeout)
|
||||
sock.close()
|
||||
|
||||
def _cache_key(self):
|
||||
return "%s__%s__" % (self._play_context.remote_addr, self._play_context.remote_user)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue