blob: 64a48727770b2297b2fd5b1699756cc658ee237f (
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
---
# file: csit/tasks/main.yml
# TODO: Temporarily disabling due to Centos8 not having netplan.
# Finding better solution via udev requires some work and testing.
#- name: Upload config to rename network interfaces
# copy:
# src: 'files/99-vppdevice.yaml'
# dest: '/etc/netplan/99-vppdevice.yaml'
# owner: 'root'
# group: 'root'
# mode: 0644
#- name: Apply network config changes
# command: '/usr/sbin/netplan apply'
- name: Centos8 install epel repositories
dnf:
name:
- 'epel-release'
when:
- ansible_distribution|lower == 'centos'
- name: Centos8 enable epel repositories
command: 'dnf config-manager --set-enabled PowerTools'
when:
- ansible_distribution|lower == 'centos'
- name: Install required system tools and packages
package:
name: "{{ csit_packages | join(',') }}"
state: 'latest'
update_cache: 'yes'
- name: Adjust number of hugepages
sysctl:
name: 'vm.nr_hugepages'
value: '512'
state: 'present'
sysctl_file: '/etc/sysctl.d/90-csit.conf'
reload: 'yes'
- name: Install docker-ce
command: |
curl -fsSL https://get.docker.com -o get-docker.sh &&
sudo sh get-docker.sh
- name: "Add user for running tests: {{ csit.test_user.name }}"
user:
name: '{{ csit.test_user.name }}'
password: '{{ csit.test_user.password }}'
home: '{{ csit.test_user.home }}'
shell: '{{ csit.test_user.shell }}'
- name: "Allow passwordless sudo for user: {{ csit.test_user.name }}"
lineinfile:
path: '/etc/sudoers.d/{{ csit.test_user.name }}'
line: '{{ csit.test_user.name }} ALL=(ALL) NOPASSWD:ALL'
create: 'yes'
- name: Add vagrant user to docker group
user:
name: 'vagrant'
groups:
- 'docker'
- name: Reload groups for current session
command: '/usr/bin/newgrp docker'
- name: Load required kernel modules
modprobe:
name: '{{ item }}'
state: 'present'
with_items:
- vfio-pci
- name: Enable required kernel modules on boot
lineinfile:
path: '/etc/modules'
line: '{{ item }}'
create: 'yes'
state: 'present'
insertafter: EOF
with_items:
- vfio-pci
- name: Clone CSIT repository
become_user: vagrant
git:
repo: '{{ csit.repository.url }}'
dest: '{{ csit.home }}'
accept_hostkey: yes
version: '{{ csit.repository.version }}'
- name: Install and update pip and virtualenv
pip:
name:
- 'virtualenv'
state: 'latest'
- name: Prepare python virtual environmant for CSIT
become_user: vagrant
command: '/usr/bin/virtualenv --python=/usr/bin/python3 {{ csit.home }}/env'
args:
chdir: '{{ csit.home }}'
creates: '{{ csit.home }}/env/bin/activate'
- name: Install python dependencies (from {{ csit.home }}/requirements.txt)
become_user: vagrant
shell: |
source '{{ csit.home }}/env/bin/activate' &&
pip3 install --timeout 300 -r '{{ csit.home }}/requirements.txt'
args:
executable: '/bin/bash'
- name: Load csit docker image from local drive if it exists (/vagrant/csit-sut.tar)
shell: |
if [ -z "$(docker images -q `cat {{ csit.home }}/VPP_DEVICE_IMAGE`)" ] && [ -e /vagrant/csit-sut.tar ]; then
docker load -i /vagrant/csit-sut.tar;
fi;
ignore_errors: yes
|