mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Move building the play_ds into a method, that can be overridden
This commit is contained in:
parent
0d606b5705
commit
670894e2bd
1 changed files with 8 additions and 7 deletions
|
@ -65,6 +65,13 @@ class AdHocCLI(CLI):
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def _play_ds(self, pattern):
|
||||||
|
return dict(
|
||||||
|
name = "Ansible Ad-Hoc",
|
||||||
|
hosts = pattern,
|
||||||
|
gather_facts = 'no',
|
||||||
|
tasks = [ dict(action=dict(module=self.options.module_name, args=parse_kv(self.options.module_args))), ]
|
||||||
|
)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
''' use Runner lib to do SSH things '''
|
''' use Runner lib to do SSH things '''
|
||||||
|
@ -117,13 +124,7 @@ class AdHocCLI(CLI):
|
||||||
# results = runner.run()
|
# results = runner.run()
|
||||||
|
|
||||||
# create a pseudo-play to execute the specified module via a single task
|
# create a pseudo-play to execute the specified module via a single task
|
||||||
play_ds = dict(
|
play_ds = self._play_ds(pattern)
|
||||||
name = "Ansible Ad-Hoc",
|
|
||||||
hosts = pattern,
|
|
||||||
gather_facts = 'no',
|
|
||||||
tasks = [ dict(action=dict(module=self.options.module_name, args=parse_kv(self.options.module_args))), ]
|
|
||||||
)
|
|
||||||
|
|
||||||
play = Play().load(play_ds, variable_manager=variable_manager, loader=loader)
|
play = Play().load(play_ds, variable_manager=variable_manager, loader=loader)
|
||||||
|
|
||||||
# now create a task queue manager to execute the play
|
# now create a task queue manager to execute the play
|
||||||
|
|
Loading…
Reference in a new issue