| |
@@ -99,21 +99,24 @@
|
| |
:param str ipaddr: IP address of the machine the task will be run on
|
| |
'''
|
| |
|
| |
- taskdir = os.path.dirname(self.arg_data['task'])
|
| |
- taskfile = os.path.basename(self.arg_data['task'])
|
| |
+ if os.path.isfile(os.path.join(self.arg_data['taskdir'], 'inventory')):
|
| |
+ sti_inventory = os.path.join(config.get_config().client_taskdir, "inventory")
|
| |
+ else:
|
| |
+ sti_inventory = "/usr/share/ansible/inventory"
|
| |
|
| |
cmd = [
|
| |
'ansible-playbook', 'runner.yml',
|
| |
'--inventory=%s,' % ipaddr,
|
| |
'-e', 'artifacts=%s' % self.arg_data['artifactsdir'],
|
| |
'-e', 'subjects=%s' % self.arg_data['item'],
|
| |
- '-e', 'taskdir=%s' % taskdir,
|
| |
- '-e', 'taskfile=%s' % taskfile,
|
| |
+ '-e', 'taskdir=%s' % self.arg_data['taskdir'],
|
| |
'-e', 'client_taskdir=%s' % config.get_config().client_taskdir,
|
| |
+ '-e', 'sti_inventory=%s' % sti_inventory,
|
| |
]
|
| |
|
| |
if self.run_remotely:
|
| |
- cmd.extend(['--private-key=%s' % self.arg_data['ssh_privkey']])
|
| |
+ if 'ssh_privkey' in self.arg_data:
|
| |
+ cmd.extend(['--private-key=%s' % self.arg_data['ssh_privkey']])
|
| |
else:
|
| |
cmd.extend(['--ask-become-pass', '--connection=local', '-e', 'local=true'])
|
| |
|
| |
@@ -135,5 +138,5 @@
|
| |
try:
|
| |
self._run_ansible_playbook(ipaddr)
|
| |
finally:
|
| |
- if self.task_vm is not None:
|
| |
+ if self.task_vm is not None and not self.arg_data['no_destroy']:
|
| |
self.task_vm.teardown()
|
| |
testplan:
git clone https://pagure.io/task-rpmlint-ansible
runtask -d -i gzip-1.8-1.fc25 -t koji_build --libvirt --no-destroy -a x86_64 task-rpmlint-ansible/run_tests.yml
fyi:
modification of runner.yml is not related ,just to wipe off warning in the log
TASK [create artifacts dir]
[WARNING]: Consider using file module with state=directory rather than running mkdir