| |
@@ -1,8 +1,9 @@
|
| |
---
|
| |
- - name: Install the RHTS pre-requirements
|
| |
+ - name: Install the Ansible and RHTS pre-requirements
|
| |
package: name={{item}} state=latest
|
| |
with_items:
|
| |
- - dnf-plugins-core # COPR plugin needed
|
| |
+ - rsync # need rsync for Ansible synchronize module
|
| |
+ - dnf-plugins-core # need COPR plugin
|
| |
- beakerlib
|
| |
- make
|
| |
- createrepo
|
| |
@@ -22,6 +23,11 @@
|
| |
with_items:
|
| |
- "{{ required_packages }}"
|
| |
|
| |
+ - name: Define remote_artifacts if it is not already defined
|
| |
+ set_fact:
|
| |
+ remote_artifacts: /tmp/artifacts
|
| |
+ when: remote_artifacts is not defined
|
| |
+
|
| |
- name: Create legacy beakerlib directories
|
| |
file:
|
| |
dest: "{{ item }}"
|
| |
@@ -134,49 +140,51 @@
|
| |
chmod 644 /root/.ssh/authorized_keys
|
| |
|
| |
- name: Make artifacts directory
|
| |
- file: path={{ artifacts }} state=directory owner=root mode=755 recurse=yes
|
| |
+ file: path={{ remote_artifacts }} state=directory owner=root mode=755 recurse=yes
|
| |
|
| |
- name: Start restraintd
|
| |
# instead of using service module, daemon is started directly since we want the
|
| |
# output as an artifact (and this could be running in a container)
|
| |
- shell: nohup /usr/bin/restraintd >"{{ artifacts }}/restraintd.log" 2>&1 &
|
| |
+ shell: nohup /usr/bin/restraintd >"{{ remote_artifacts }}/restraintd.log" 2>&1 &
|
| |
|
| |
- name: Start local web server for restraint
|
| |
- shell: nohup /usr/bin/python -m SimpleHTTPServer "{{ local_www_port }}" >"{{ artifacts }}/httpd.log" 2>&1 &
|
| |
+ shell: nohup /usr/bin/python -m SimpleHTTPServer "{{ local_www_port }}" >"{{ remote_artifacts }}/httpd.log" 2>&1 &
|
| |
args:
|
| |
chdir: "{{ local_www_dir }}/"
|
| |
|
| |
- block:
|
| |
- name: Execute RHTS tests using restraint
|
| |
- shell: /usr/bin/restraint --host localhost --job "{{ job_xml_file }}" >"{{ artifacts }}/restraint.log" 2>&1
|
| |
+ shell: /usr/bin/restraint --host localhost --job "{{ job_xml_file }}" >"{{ remote_artifacts }}/restraint.log" 2>&1
|
| |
args:
|
| |
- chdir: "{{ artifacts }}/"
|
| |
+ chdir: "{{ remote_artifacts }}/"
|
| |
ignore_errors: True
|
| |
|
| |
+ - always:
|
| |
- name: Extract job output directory from restraint logfile
|
| |
- shell: sed -n 's/^Using \([^ ]*\).*$/\1/p' "{{ artifacts }}/restraint.log"
|
| |
+ shell: sed -n 's/^Using \([^ ]*\).*$/\1/p' "{{ remote_artifacts }}/restraint.log"
|
| |
register: restraint_job_dir
|
| |
|
| |
- name: Make job ouput directory tree readable by all
|
| |
file:
|
| |
- path: "{{ artifacts }}/{{restraint_job_dir.stdout}}"
|
| |
+ path: "{{ remote_artifacts }}/{{restraint_job_dir.stdout}}"
|
| |
mode: u=rwX,g=rX,o=rX
|
| |
recurse: yes
|
| |
|
| |
- name: Set name of restraint XML job results file
|
| |
- set_fact: results_xml="{{ artifacts }}/{{restraint_job_dir.stdout}}/job.xml"
|
| |
+ set_fact: results_xml="{{ remote_artifacts }}/{{restraint_job_dir.stdout}}/job.xml"
|
| |
|
| |
- name: Convert restraint XML job results to text as main output artifact
|
| |
- shell: xsltproc /usr/local/share/job2text.xsl "{{ results_xml }}" >"{{ artifacts }}/test.log"
|
| |
+ shell: xsltproc /usr/local/share/job2text.xsl "{{ results_xml }}" >"{{ remote_artifacts }}/test.log"
|
| |
+
|
| |
+ - name: Pull out the logs
|
| |
+ synchronize:
|
| |
+ dest: "{{ artifacts }}/"
|
| |
+ src: "{{ remote_artifacts }}/"
|
| |
+ mode: pull
|
| |
+ ssh_args: "-o UserKnownHostsFile=/dev/null"
|
| |
+ when: artifacts|default("") != ""
|
| |
|
| |
- name: Check the results for failures
|
| |
- shell: grep '^FAIL ' "{{ artifacts }}/test.log"
|
| |
+ shell: grep '^FAIL ' "{{ remote_artifacts }}/test.log"
|
| |
register: test_fails
|
| |
failed_when: test_fails.stdout or test_fails.stderr
|
| |
-
|
| |
- - always:
|
| |
- - name: Pull out the logs
|
| |
- fetch:
|
| |
- dest: "{{artifacts}}/"
|
| |
- src: "{{artifacts}}/"
|
| |
- flat: yes
|
| |