From 37ad8b0bf9ebef30ca58addfcb872dd802011b72 Mon Sep 17 00:00:00 2001 From: Merlin Mathesius Date: Apr 26 2017 19:46:32 +0000 Subject: Add repo and avocado roles. --- diff --git a/roles/standard-test-avocado/README.md b/roles/standard-test-avocado/README.md new file mode 100644 index 0000000..1d6aabd --- /dev/null +++ b/roles/standard-test-avocado/README.md @@ -0,0 +1,7 @@ +# Ansible role for Avocado tests + +Put this role in your test_local.yml playbook. You'll need +to have the following variables defined: + + * tests: A list of Avocado test files + * artifacts: An artifacts directory diff --git a/roles/standard-test-avocado/tasks/main.yml b/roles/standard-test-avocado/tasks/main.yml new file mode 100644 index 0000000..78c2b2c --- /dev/null +++ b/roles/standard-test-avocado/tasks/main.yml @@ -0,0 +1,19 @@ +--- +- name: Install the avocado requirements + package: name={{item}} state=latest + with_items: + - python2-avocado + +- name: Make artifacts directory + file: path={{ artifacts }} state=directory owner=root mode=755 recurse=yes + +- block: + - name: Execute the avocado test + shell: exec 2>>{{artifacts}}/test.log 1>>{{artifacts}}/test.log; MODULE=rpm python -m avocado run --job-results-dir {{artifacts}}/ {{tests|join(' ') }} + +- always: + - name: Pull out the logs + fetch: + dest: "{{artifacts}}/" + src: "{{artifacts}}/" + flat: yes diff --git a/roles/standard-test-avocado/vars/main.yml b/roles/standard-test-avocado/vars/main.yml new file mode 100644 index 0000000..6e9c8cb --- /dev/null +++ b/roles/standard-test-avocado/vars/main.yml @@ -0,0 +1,3 @@ +--- +artifacts: ./artifacts +tests: [] diff --git a/roles/standard-test-repo/README.md b/roles/standard-test-repo/README.md new file mode 100644 index 0000000..1e0a072 --- /dev/null +++ b/roles/standard-test-repo/README.md @@ -0,0 +1,10 @@ +# Ansible role for YUM repo subjects + +Put this role in your test_repo.yml playbook. You'll need +to have the following variables defined: + + * subjects: Space separated list of repo files to enable + * packages: List of packages to install from those repos + +Include any playbooks after this role with tests you want to +run. For example test_repo.yml diff --git a/roles/standard-test-repo/tasks/main.yml b/roles/standard-test-repo/tasks/main.yml new file mode 100644 index 0000000..4e6d85b --- /dev/null +++ b/roles/standard-test-repo/tasks/main.yml @@ -0,0 +1,7 @@ +--- +- name: Enable the test subject repo + shell: yum config-manager --add-repo "{{ subjects }}" + +- name: Install the RPMs from that repo + package: name={{item}} state=latest + with_items: "{{ packages }}" diff --git a/roles/standard-test-repo/vars/main.yml b/roles/standard-test-repo/vars/main.yml new file mode 100644 index 0000000..fd98cf6 --- /dev/null +++ b/roles/standard-test-repo/vars/main.yml @@ -0,0 +1,3 @@ +--- +artifacts: ./artifacts +packages: []