aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/testbed-setup/playbooks/01-host-setup.yaml
blob: a9e9989cfe9b5e7434777d139de318c9d9a2a06a (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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
---
- hosts: all
  remote_user: testuser
  sudo: yes
  tasks:
  - name: copy sudoers file
    copy: src=files/sudoers dest=/etc/sudoers.d/testuser owner=root group=root mode=660
  - name: copy hosts file
    template: src=files/hosts dest=/etc/hosts owner=root group=root mode=644
  - name: copy hostname file
    template: src=files/hostname dest=/etc/hostname owner=root group=root mode=644
  - name: copy grub file
    template: src=files/grub dest=/etc/default/grub owner=root group=root mode=644
  - name: update grub
    command: update-grub
  - name: copy apt sources file
    template: src=files/apt-sources.list dest=/etc/apt/sources.list
  - name: install python-apt
    raw: apt-get update && apt-get install python-apt -y -q
  - name: update repositories
    apt: update_cache=yes
  - name: install git
    apt: name=git state=present
  - name: install crudini
    apt: name=crudini state=present
  - name: install expect
    apt: name=expect state=present
  - name: install socat
    apt: name=socat state=present
  - name: install qemu
    apt: name=qemu-system-x86 state=present
  - name: Install packages to allow apt to use a repository over HTTPS
    apt: name=apt-transport-https state=present
- hosts: virl
  remote_user: testuser
  sudo: yes
  tasks:
  - name: interfaces file
    template: src=files/interfaces_virl dest=/etc/network/interfaces owner=root group=root mode=644
  - name: Add VIRL user
    user: name=virl shell=/bin/bash comment="VIRL user" password="$6$mJPlK5FKLar6$xxXPP0LRhC7T1yhHtym18Z3nKZweTtfTxzi1WpvVHJ0U/Em1UWcHqfMhRApFp0rsY9jHRuL6FfeFbKPN..uDK."
  - name: Add VIRL user to sudoers
    copy: src=files/sudoers_virl dest=/etc/sudoers.d/virl owner=root group=root mode=660
  - name: Add post up for additional address
    copy: src=files/ifup dest=/etc/network/if-up.d/virl owner=root group=root mode=755
  - name: Set VIRL user authorized key
    authorized_key: user=virl key="{{ lookup('file', '/home/testuser/.ssh/id_rsa.pub') }}"
  - name: install bridge-utils
    apt: name=bridge-utils state=present
  - name: Old interface naming
    command: ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules
  - name: update init for old interface naming
    command: update-initramfs -u
  - name: QEMU log garbage collector
    cron: minute="0" hour="0"
          name="QEMU log garbage collector"
          job="find /var/log/libvirt/qemu -type f -mtime +14 -name 'instance*.log' -delete"
  - name: VPP deb package garbage collector
    cron: minute="0" hour="0"
          name="VPP deb package garbage collector"
          job="find /tmp -type f -atime +14 -name '*.deb' -delete"
  - name: VPP rpm package garbage collector
    cron: minute="0" hour="0"
          name="VPP rpm package garbage collector"
          job="find /tmp -type f -atime +14 -name '*.rpm' -delete"
  - name: NFS scratch dir garbage collector
    cron: minute="0" hour="0"
          name="NFS scratch dir garbage collector"
          job="find /nfs/scratch/ -type d -mtime +1 -name 'session-*' -exec rm -r '{}' \\;"
- hosts: tg:sut
  remote_user: testuser
  sudo: yes
  tasks:
  - name: interfaces file
    template: src=files/interfaces_physical dest=/etc/network/interfaces owner=root group=root mode=644
  - name: copy sysctl file
    template: src=files/90-csit dest=/etc/sysctl.d/90-csit.conf owner=root group=root mode=644
  - name: isolcpus and pstate parameter
    lineinfile: dest=/etc/default/grub regexp=^GRUB_CMDLINE_LINUX= line=GRUB_CMDLINE_LINUX="\"isolcpus={{ isolcpus }} nohz_full={{ isolcpus }} rcu_nocbs={{ isolcpus }} intel_pstate=disable\""
  - name: update grub
    command: update-grub
  - name: Install python-dev
    apt: name=python-dev state=present
  - name: Install python-virtualenv
    apt: name=python-virtualenv state=present
  - name: Install python pip
    apt: name=python-pip state=present
  - name: Install libpcap-dev
    apt: name=libpcap-dev state=present
  - name: Install cpufrequtils
    apt: name=cpufrequtils state=present
  - name: Set cpufrequtils defaults
    copy: src=files/cpufrequtils dest=/etc/default/cpufrequtils owner=root group=root mode=0644
  - name: Disable IRQ load balancing
    copy: src=files/irqbalance dest=/etc/default/irqbalance owner=root group=root mode=0644
  - name: Disable ondemand
    service: name=ondemand enabled=no
  - name: Install cgroup-support
    apt: name=cgroup-bin state=present
  - name: Install zlib1g-dev
    apt: name=zlib1g-dev state=present
  - name: Copy Python requirements file
    copy: src=files/requirements.txt dest=/tmp/requirements.txt
  - name: Install PIP requirements
    pip: requirements=/tmp/requirements.txt
  - name: IRQ pinning
    lineinfile:
        dest: /etc/rc.local
        insertbefore: '^exit 0'
        line: 'for l in `ls /proc/irq`; do echo 1 | sudo tee /proc/irq/$l/smp_affinity; done'
  - name: RCU pinning
    lineinfile:
        dest: /etc/rc.local
        insertbefore: '^exit 0'
        line: 'for i in `pgrep rcu[^c]` ; do sudo taskset -pc 0 $i ; done'
  - name: CPU writeback mask
    lineinfile:
        dest: /etc/rc.local
        insertbefore: '^exit 0'
        line: 'echo 1 | sudo tee /sys/bus/workqueue/devices/writeback/cpumask'
- hosts: tg
  remote_user: testuser
  sudo: yes
  tasks:
  - name: Install unzip
    apt: name=unzip state=present
- hosts: sut
  remote_user: testuser
  sudo: yes
  tasks:
  - name: Install dkms
    apt: name=dkms state=present
  - name: Install pkg-config
    apt: name=pkg-config state=present
  - name: Install libglib2.0-dev
    apt: name=libglib2.0-dev state=present
  - name: Install autoconf
    apt: name=autoconf state=present
  - name: Install libtool
    apt: name=libtool state=present
  - name: Install screen
    apt: name=screen state=present
  - name: Install lxc
    apt: name=lxc state=present
  - name: Disable 80-vpp.conf
    file:
        src: /dev/null
        dest: /etc/sysctl.d/80-vpp.conf
        state: link
  - name: Install java
    apt: name=openjdk-8-jdk state=present
  - name: Add Docker's official GPG key
    apt_key:
        url: "https://download.docker.com/linux/ubuntu/gpg"
        state: present
  - name: Add Docker's stable repository
    apt_repository:
        repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
        state: present
  - name: Install Docker CE
    apt: name=docker-ce state=present
  - name: Add Kubernetes's official GPG key
    apt_key:
        url: "https://packages.cloud.google.com/apt/doc/apt-key.gpg"
        state: present
  - name: Add Kubernetes's stable repository
    apt_repository:
        repo: deb http://apt.kubernetes.io/ kubernetes-xenial main
        state: present
  - name: Install Kubernetes kubelet
    apt: name=kubelet state=present
  - name: Install Kubernetes kubeadm
    apt: name=kubeadm state=present