2021-05-03 09:38:16 +00:00
|
|
|
---
|
|
|
|
- name: Set ansible_python_interpreter to /usr/libexec/platform-python
|
|
|
|
set_fact:
|
2021-06-09 16:13:19 +00:00
|
|
|
ansible_python_interpreter: auto
|
|
|
|
|
2021-05-03 09:38:16 +00:00
|
|
|
- name: Define remote_artificats
|
|
|
|
set_fact:
|
|
|
|
remote_artifacts: /tmp/artifacts
|
|
|
|
when: remote_artifacts is not defined
|
2021-06-09 16:13:19 +00:00
|
|
|
|
2021-05-03 09:38:16 +00:00
|
|
|
- name: Install testing requirements
|
|
|
|
package: name={{ item }} state=present
|
|
|
|
with_items:
|
|
|
|
- rsync
|
|
|
|
when: ansible_pkg_mgr != 'unknown'
|
2021-06-09 16:13:19 +00:00
|
|
|
|
|
|
|
- name: Install sshpass from epel
|
|
|
|
shell: yum --enablerepo epel install sshpass -y
|
|
|
|
|
2021-05-03 09:38:16 +00:00
|
|
|
- name: Install required packages
|
|
|
|
dnf:
|
|
|
|
name: >
|
|
|
|
git, gcc, redhat-rpm-config.noarch, openldap-devel,
|
|
|
|
openldap-clients, dbus-tools, python3-virtualenv, make,
|
|
|
|
python3-pip, krb5-devel, sssd, sssd-kcm, libsss_sudo,
|
|
|
|
ldb-tools, sssd-tools, nss-tools, sssd-dbus, python3-devel
|
2021-06-09 16:13:19 +00:00
|
|
|
|
2021-05-03 09:38:16 +00:00
|
|
|
- name: Install 389-ds-base krb5 server and workstation
|
|
|
|
dnf:
|
|
|
|
name: >
|
|
|
|
389-ds-base, krb5-server, krb5-workstation
|
2021-06-09 16:13:19 +00:00
|
|
|
|
2021-05-03 09:38:16 +00:00
|
|
|
- name: clone upstream sssd git to run tests
|
|
|
|
git:
|
|
|
|
repo: "{{ upstream_sssd_git }}"
|
|
|
|
dest: "{{ upstream_src_dir }}"
|
|
|
|
version: "{{ upstream_git_branch }}"
|
2021-06-09 16:13:19 +00:00
|
|
|
|
2021-05-03 09:38:16 +00:00
|
|
|
- name: Update /etc/hosts file with current hostname
|
|
|
|
lineinfile:
|
|
|
|
path: /etc/hosts
|
|
|
|
line: "{{ ansible_default_ipv4.address }} {{ ansible_hostname }}"
|
2021-06-09 16:13:19 +00:00
|
|
|
|
2021-05-03 09:38:16 +00:00
|
|
|
- name: Create Multihost configuration files
|
|
|
|
blockinfile:
|
|
|
|
dest: /tmp/mhc.yaml
|
|
|
|
block: |
|
|
|
|
windows_test_dir: '/home/Administrator'
|
|
|
|
root_password: 'foobar'
|
|
|
|
domains:
|
|
|
|
- name: testrealm.test
|
|
|
|
type: sssd
|
|
|
|
hosts:
|
|
|
|
- name: {{ ansible_hostname }}
|
|
|
|
external_hostname: {{ ansible_hostname }}
|
|
|
|
role: master
|
|
|
|
create: yes
|
|
|
|
marker: ""
|
2021-06-09 16:13:19 +00:00
|
|
|
|
2021-05-03 09:38:16 +00:00
|
|
|
- name: Install pytest-multihost and other test dependencies
|
|
|
|
pip:
|
2021-06-09 16:13:19 +00:00
|
|
|
name: >
|
|
|
|
setuptools, pytz, paramiko, pep8, pylint,
|
|
|
|
pytest-multihost, python-ldap, pytest, pyyaml
|
2021-05-03 09:38:16 +00:00
|
|
|
virtualenv: "{{ venv_dir }}"
|
|
|
|
virtualenv_command: /usr/bin/virtualenv
|
2021-06-09 16:13:19 +00:00
|
|
|
|
2021-05-03 09:38:16 +00:00
|
|
|
- name: Find directory python searches for path
|
|
|
|
shell: python3 -m site --user-site
|
|
|
|
register: pypath
|
2021-06-09 16:13:19 +00:00
|
|
|
|
2021-05-03 09:38:16 +00:00
|
|
|
- name: Create Python path dir
|
|
|
|
file:
|
|
|
|
path: "{{ pypath.stdout }}"
|
|
|
|
state: directory
|
2021-06-09 16:13:19 +00:00
|
|
|
|
2021-05-03 09:38:16 +00:00
|
|
|
- name: Create file with sssd testlib path
|
|
|
|
copy:
|
|
|
|
dest: "{{ pypath.stdout }}/sssdlib.pth"
|
|
|
|
content: "{{ upstream_src_dir }}/src/tests/multihost"
|
2021-06-09 16:13:19 +00:00
|
|
|
|
2021-05-03 09:38:16 +00:00
|
|
|
- name: create artifacts directory
|
|
|
|
file:
|
|
|
|
path: "{{ remote_artifacts }}"
|
|
|
|
state: directory
|
|
|
|
mode: 0755
|
2021-06-09 16:13:19 +00:00
|
|
|
|
2021-05-03 09:38:16 +00:00
|
|
|
- name: Test block
|
|
|
|
block:
|
|
|
|
- name: Execute pytest
|
|
|
|
shell: |
|
2021-06-09 16:13:19 +00:00
|
|
|
PYTESTMULTIHOST_SSH_TRANSPORT=openssh \
|
2021-05-03 09:38:16 +00:00
|
|
|
"{{ venv_dir }}/bin/pytest" -v \
|
|
|
|
--junit-xml="{{ remote_artifacts }}/junit.xml" \
|
|
|
|
--multihost-config=/tmp/mhc.yaml \
|
|
|
|
"{{ test_dir }}" 1> "{{ remote_artifacts }}/test.log"
|
2021-06-09 16:13:19 +00:00
|
|
|
|
2021-05-03 09:38:16 +00:00
|
|
|
always:
|
|
|
|
- name: copy sssd logs to "{{ remote_artifacts }}"
|
|
|
|
command: cp -a /var/log/sssd {{ remote_artifacts }}
|
2021-06-09 16:13:19 +00:00
|
|
|
|
2021-05-03 09:38:16 +00:00
|
|
|
- name: Pull out logs
|
|
|
|
synchronize:
|
|
|
|
dest: "{{ artifacts }}"
|
|
|
|
src: "{{ remote_artifacts }}/"
|
|
|
|
mode: pull
|
|
|
|
ssh_args: "-o UserKnownHostsFile=/dev/null"
|
|
|
|
when: artifacts|default("") != ""
|