summaryrefslogtreecommitdiffstats
path: root/xci/playbooks/roles/prepare-tests/tasks/main.yml
blob: b75965df3795d2be096ee3c2743a6b0f76560f4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2017 SUSE Linux GmbH
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

- name: install required packages
  package:
    name: "{{ required_packages[ansible_pkg_mgr] }}"
    state: present

# Docker is needed for test frameworks
- name: Ensure Docker service is started and enabled
  service:
    name: docker
    state: started
    enabled: yes

- name: install required pip packages
  pip:
   name: "{{ required_pip }}"
   state: present
   extra_args: '-c https://raw.githubusercontent.com/openstack/requirements/{{ requirements_git_install_branch }}/upper-constraints.txt'

- name: create public network gateway for testing
  block:
    - name: check if the gateway was already set
      shell: "ip a | grep {{ gateway_ip }}"
      register: gateway_ip_result
      ignore_errors: True
      changed_when: False

    - name: add public network gateway
      command: "ip addr add {{ gateway_ip_mask }} brd {{ broadcast_ip }} dev {{ gateway_interface }}"
      changed_when: False
      when: gateway_ip_result|failed
  when: deploy_scenario is match("os-.*")

- name: prepare environment file for tests
  template:
    src: env.j2
    dest: /root/env
    mode: 0755

- name: create the script to prepare for testing
  template:
    src: prepare-tests.sh.j2
    dest: /root/prepare-tests.sh
    mode: 0755

- name: create the script to run functest
  template:
    src: run-functest.sh.j2
    dest: /root/run-functest.sh
    mode: 0755