| |
@@ -1,105 +1,5 @@
|
| |
---
|
| |
|
| |
- - name: Packages to be present on the system.
|
| |
- set_fact:
|
| |
- # Separate debuginfo and ordinary packages. There is an issue on GitHub:
|
| |
- # https://github.com/ansible/ansible/issues/31579. The easiest way to
|
| |
- # install debuginfo for package is to use 'debuginfo-install'. This
|
| |
- # program is present on RHEL/CentOS/Fedora and it automatically enables
|
| |
- # debuginfo repos.
|
| |
- pkgs_ordinary_req: >
|
| |
- {{
|
| |
- required_packages |
|
| |
- reject('match', '.*-debuginfo$') |
|
| |
- list
|
| |
- }}
|
| |
- pkgs_debuginfo_req: >
|
| |
- {{
|
| |
- required_packages |
|
| |
- select('match', '.*-debuginfo$') |
|
| |
- list |
|
| |
- regex_replace('-debuginfo')
|
| |
- }}
|
| |
-
|
| |
- - name: Target OS identification
|
| |
- block:
|
| |
- - name: Test if system is Atomic Host
|
| |
- lineinfile:
|
| |
- name: /etc/os-release
|
| |
- regexp: .*Atomic Host.*
|
| |
- state: absent
|
| |
- check_mode: yes
|
| |
- changed_when: False
|
| |
- register: os_release_atomic
|
| |
- - name: Set Ansible fact 'is_atomic_host'
|
| |
- set_fact:
|
| |
- is_atomic_host: "{{ os_release_atomic.found > 0 }}"
|
| |
-
|
| |
- - block:
|
| |
- - name: Install the basic requirements on target
|
| |
- package: name={{item}} state=latest
|
| |
- with_items:
|
| |
- - rsync # needed to copy tests to target
|
| |
-
|
| |
- - name: Install any test-specific package requirements
|
| |
- # Note, this method cannot install -debuginfo packages.
|
| |
- package: name={{item}} state=latest
|
| |
- with_items:
|
| |
- - "{{ pkgs_ordinary_req }}"
|
| |
-
|
| |
- - block:
|
| |
- - name: Install yum-utils
|
| |
- package: name=yum-utils state=latest
|
| |
- when: ansible_pkg_mgr == 'yum'
|
| |
-
|
| |
- - name: Install dnf-utils
|
| |
- # System can have installed yum-utils. Which conflicts wih dnf-utils.
|
| |
- # Therefore, remove yum-utils and install dnf-utils.
|
| |
- shell: dnf --assumeyes --allowerasing install dnf-utils
|
| |
- when: ansible_pkg_mgr == 'dnf'
|
| |
-
|
| |
- - name: Care about debuginfo packages for DNF/YUM systems
|
| |
- shell: |
|
| |
- debuginfo-install --assumeyes {{item}}
|
| |
- with_items:
|
| |
- - "{{ pkgs_debuginfo_req }}"
|
| |
- when:
|
| |
- - "[ansible_pkg_mgr] | intersect(['dnf', 'yum'])"
|
| |
- - pkgs_debuginfo_req
|
| |
-
|
| |
- # Only manually install packages on non atomic hosts
|
| |
- when: ansible_pkg_mgr != 'unknown'
|
| |
-
|
| |
- - block:
|
| |
- - name: Check presence of required packages for Atomic Host
|
| |
- shell: rpm -q {{ pkgs_ordinary_req|join(" ") }}
|
| |
- register: package_check
|
| |
- changed_when: False
|
| |
- failed_when: False
|
| |
- args: { warn: no }
|
| |
- - name: Install required packages at Atomic Host
|
| |
- shell:
|
| |
- rpm-ostree install {{ pkgs_ordinary_req|join(" ") }}
|
| |
- && rpm-ostree ex livefs
|
| |
- when: package_check.rc != 0
|
| |
- when:
|
| |
- - is_atomic_host
|
| |
- - pkgs_ordinary_req
|
| |
-
|
| |
- - name: Define remote_artifacts if it is not already defined
|
| |
- set_fact:
|
| |
- remote_artifacts: /tmp/artifacts
|
| |
- when: remote_artifacts is not defined
|
| |
-
|
| |
- - name: Copy tests to target
|
| |
- synchronize:
|
| |
- src: "{{ playbook_dir }}/"
|
| |
- dest: /usr/local/bin/
|
| |
- ssh_args: "-o UserKnownHostsFile=/dev/null"
|
| |
-
|
| |
- - name: Make artifacts directory
|
| |
- file: path={{ remote_artifacts }} state=directory owner=root mode=755 recurse=yes
|
| |
-
|
| |
- block:
|
| |
- name: Execute tests
|
| |
shell: |
|
| |
@@ -123,23 +23,19 @@
|
| |
TEST:
|
| |
"{{item if item.keys is not defined else item.keys()[0]}}"
|
| |
TEST_DIR:
|
| |
- "/usr/local/bin/{{item if item.keys is not defined else item[item.keys()[0]]['dir']|default(item.keys()[0])}}"
|
| |
+ "{{ tenv_workdir }}/{{ item if item.keys is not defined else item[item.keys()[0]]['dir']|default(item.keys()[0]) }}"
|
| |
TEST_CMD:
|
| |
"{{'./runtest.sh' if item.keys is not defined else item[item.keys()[0]]['run']|default('./runtest.sh')}}"
|
| |
with_items:
|
| |
- "{{ tests }}"
|
| |
|
| |
- - name: Pull out the logs
|
| |
- synchronize:
|
| |
- dest: "{{ artifacts }}/"
|
| |
- src: "{{ remote_artifacts }}/"
|
| |
- mode: pull
|
| |
- ssh_args: "-o UserKnownHostsFile=/dev/null"
|
| |
- when: artifacts|default("") != ""
|
| |
-
|
| |
# Can't go in block. See
|
| |
# https://github.com/ansible/ansible/issues/20736
|
| |
- name: Check the results
|
| |
shell: grep "^FAIL" {{ remote_artifacts }}/test.log
|
| |
register: test_fails
|
| |
failed_when: test_fails.stdout or test_fails.stderr
|
| |
+
|
| |
+ - include_role:
|
| |
+ name: str-common
|
| |
+ tasks_from: end.yml
|
| |