Bruno Wolff III afc879
---
Bruno Wolff III afc879
- hosts: localhost
Bruno Wolff III afc879
  vars:
Bruno Wolff III afc879
  - artifacts: ./artifacts
Bruno Wolff III afc879
  tags:
Bruno Wolff III afc879
  - classic
Bruno Wolff III afc879
  remote_user: root
Bruno Wolff III afc879
  tasks:
Bruno Wolff III afc879
  - name: Install the test files
Bruno Wolff III afc879
    copy: src={{ item.file }} dest=/usr/local/bin/{{ item.dest }} mode=0755
Bruno Wolff III afc879
    with_items:
Bruno Wolff III afc879
    - {file: Squashfs-compression-test.sh, dest: Squashfs-compression-test.sh }
Bruno Wolff III afc879
  - name: Test block
Bruno Wolff III afc879
    block:
Bruno Wolff III afc879
      - name: Execute the tests
Bruno Wolff III afc879
        shell: |
Bruno Wolff III afc879
          /usr/local/bin/Squashfs-compression-test.sh &> /tmp/test.log; grep -iq failed /tmp/test.log && result=fail || result=pass
Bruno Wolff III afc879
          echo -e "results:\n- {result: $result, test: working}" > /tmp/results.yml
Bruno Wolff III afc879
    always:
Bruno Wolff III afc879
      - name: Pull out the logs
Bruno Wolff III afc879
        fetch:
Bruno Wolff III afc879
          dest: "{{ artifacts }}/"
Bruno Wolff III afc879
          src: "{{ item }}"
Bruno Wolff III afc879
          flat: yes
Bruno Wolff III afc879
        with_items:
Bruno Wolff III afc879
          - /tmp/test.log
Bruno Wolff III afc879
          - /tmp/results.yml