0eb09e7b4f
Don't use a shell builtin: shell builtins aren't available since 'command' ansible module is used. Instead, fail with an explicit error when the required test_command variable is not set. Fix this error: Ansible output: b'failed: [host] (item=exit 1) => { "ansible_loop_var": "item", "changed": false, "cmd": "exit 1", "item": "exit 1", "msg": "[Errno 2] No such file or directory: 'exit': 'exit'", "rc": 2 } Change-Id: I88303f7302d7354ffc8b18e607b28349a9860a57
24 lines
663 B
YAML
24 lines
663 B
YAML
- hosts: all
|
|
|
|
tasks:
|
|
- name: Abort when test_command variable is undefined
|
|
fail:
|
|
msg: mandatory test_command variable is undefined
|
|
when: test_command is undefined
|
|
|
|
- name: Convert test_command to list
|
|
set_fact:
|
|
test_commands: ['{{ test_command }}']
|
|
when: test_command | type_debug != 'list'
|
|
|
|
- name: Use test_command list
|
|
set_fact:
|
|
test_commands: '{{ test_command }}'
|
|
when: test_command | type_debug == 'list'
|
|
|
|
- name: Run test_command
|
|
command: '{{ item }}'
|
|
args:
|
|
chdir: '{{ zuul_work_dir | default(zuul.project.src_dir) }}'
|
|
with_items: '{{ test_commands }}'
|