# Variables: devstack_base_dir, cinderlib_log_file, cinderlib_ignore_errors - hosts: all become: True vars: base_dir: "{{ devstack_base_dir | default('/opt/stack/new') }}" default_log_file: "{{ base_dir }}/logs/cinderlib.txt" tasks: - name: Locate unit2 binary location shell: cmd: which unit2 register: unit2_which - name: Add sudoers role for cinderlib unit2 copy: dest: /etc/sudoers.d/zuul-sudo-unit2 content: "zuul ALL = NOPASSWD:{{ unit2_which.stdout }} discover -v -s cinderlib/tests/functional\n" mode: 0440 - name: Validate sudoers config after edits command: "/usr/sbin/visudo -c" - name: Run cinderlib functional tests shell: cmd: "set -o pipefail && {{ unit2_which.stdout }} discover -v -s cinderlib/tests/functional 2>&1 | tee {{ cinderlib_log_file | default(default_log_file)}}" chdir: "{{ base_dir }}/cinderlib" executable: /bin/bash ignore_errors: "{{ cinderlib_ignore_errors | default(false) | bool}}"