|
|
@ -21,6 +21,7 @@ __metaclass__ = type
|
|
|
|
########################################################
|
|
|
|
########################################################
|
|
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
|
|
|
|
import signal
|
|
|
|
|
|
|
|
|
|
|
|
from ansible import constants as C
|
|
|
|
from ansible import constants as C
|
|
|
|
from ansible.cli import CLI
|
|
|
|
from ansible.cli import CLI
|
|
|
@ -88,6 +89,10 @@ class AdHocCLI(CLI):
|
|
|
|
tasks = [ dict(action=dict(module=self.options.module_name, args=parse_kv(self.options.module_args)), async=async, poll=poll) ]
|
|
|
|
tasks = [ dict(action=dict(module=self.options.module_name, args=parse_kv(self.options.module_args)), async=async, poll=poll) ]
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _terminate(self, signum=None, framenum=None):
|
|
|
|
|
|
|
|
if signum is not None:
|
|
|
|
|
|
|
|
display.debug("Termination signal detected, shutting down gracefully")
|
|
|
|
|
|
|
|
raise SystemExit
|
|
|
|
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
def run(self):
|
|
|
|
''' use Runner lib to do SSH things '''
|
|
|
|
''' use Runner lib to do SSH things '''
|
|
|
@ -171,6 +176,9 @@ class AdHocCLI(CLI):
|
|
|
|
# now create a task queue manager to execute the play
|
|
|
|
# now create a task queue manager to execute the play
|
|
|
|
self._tqm = None
|
|
|
|
self._tqm = None
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
|
|
|
|
# Manage user interruptions
|
|
|
|
|
|
|
|
signal.signal(signal.SIGTERM, self._terminate)
|
|
|
|
|
|
|
|
|
|
|
|
self._tqm = TaskQueueManager(
|
|
|
|
self._tqm = TaskQueueManager(
|
|
|
|
inventory=inventory,
|
|
|
|
inventory=inventory,
|
|
|
|
variable_manager=variable_manager,
|
|
|
|
variable_manager=variable_manager,
|
|
|
|