diff options
Diffstat (limited to 'resources/tools/testbed-setup')
83 files changed, 1047 insertions, 334 deletions
diff --git a/resources/tools/testbed-setup/README.md b/resources/tools/testbed-setup/README.md index 720ba0f989..e97fa22dfb 100644 --- a/resources/tools/testbed-setup/README.md +++ b/resources/tools/testbed-setup/README.md @@ -80,12 +80,14 @@ is available on the PXE bootstrap server in ~testuser/host-setup. - set CIMC address - set CIMC username, password and hostname +- set IPMI address +- set IPMI username, password and hostname ### Bootstrap the host -From PXE boostrap server: +Optional: From PXE boostrap server in case of installing Haswell - - `cd ~testuser/host-setup/cimc` + - `cd resources/tools/testbed-setup/cimc` - Initialize args.ip: Power-Off, reset BIOS defaults, Enable console redir, get LOM MAC addr - `./cimc.py -u admin -p Cisco1234 $CIMC_ADDRESS -d -i` - Adjust BIOS settings @@ -94,7 +96,7 @@ From PXE boostrap server: - Reboot server with boot from PXE (restart immediately) - `./cimc.py -u admin -p Cisco1234 $CIMC_ADDRESS -d -pxe` -While Ubuntu install is running: +Optional: If RAID is not created on Haswells. Execute while Ubuntu install is running - create RAID array. Reboot if needed. - `./cimc.py -u admin -p Cisco1234 $CIMC_ADDRESS -d --wipe` @@ -104,35 +106,18 @@ While Ubuntu install is running: - Set the next boot from HDD (without restart) - `./cimc.py -u admin -p Cisco1234 $CIMC_ADDRESS -d -hdd` -When installation is finished: - - - `ssh-copy-id 10.30.51.x` - - `cd ~testuser/host-setup/playbooks` - - edit /etc/ansible/hosts; add the hosts you are installing. *REMOVE ANY HOSTS YOU ARE NOT CURRENTLY INSTALLING*. - - Example for physical testbed hosts: - ~~~ - [tg] - 10.30.51.24 hostname=t3-tg1 isolcpus="1-17,19-35" ansible_python_interpreter=/usr/bin/python2.7 - - [sut] - 10.30.51.25 hostname=t3-sut1 isolcpus="1-17,19-35" ansible_python_interpreter=/usr/bin/python2.7 - 10.30.51.26 hostname=t3-sut2 isolcpus="1-17,19-35" ansible_python_interpreter=/usr/bin/python2.7 - ~~~ +Optional: If installing Skylake machine, connect to IPMI and boot from PXE via F12 - Example for VIRL hosts -- use the "virl" tag and specify the flat network start and end addresses: - - ~~~ - [virl] - 10.30.51.28 hostname=t4-virl1 virl_l2_start=10.30.52.2 virl_l2_end=10.30.52.253 virl_l2_network=10.30.52.0/24 virl_l2_ip=10.30.52.254 virl_public_port=eth0 - ~~~ +When installation is finished: - - `ansible-playbook --ask-sudo-pass 01-host-setup.yaml` - - `ansible-playbook reboot.yaml` + - Copy ssh keys for no pass access: `ssh-copy-id 10.30.51.x` + - Clone CSIT actual repo: `git clone https://gerrit.fd.io/r/csit` + - Go to ansible directory: `cd csit/resources/tools/testbed-setup/ansible` + - Edit production file and uncomment servers that are supposed to be installed: `ansible-playbook --ask-become-pass --inventory production site.yaml --list-hosts` + - Run ansible on selected hosts: `ansible-playbook --ask-become-pass --inventory production site.yaml` For non-VIRL hosts, stop here. - ### VIRL installation After the host has rebooted: diff --git a/resources/tools/testbed-setup/ansible/group_vars/all.yaml b/resources/tools/testbed-setup/ansible/group_vars/all.yaml new file mode 100644 index 0000000000..443f789a11 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/group_vars/all.yaml @@ -0,0 +1,4 @@ +--- +# file: group_vars/all.yaml + +ansible_python_interpreter: "/usr/bin/python2.7" diff --git a/resources/tools/testbed-setup/ansible/group_vars/haswell/sut.yaml b/resources/tools/testbed-setup/ansible/group_vars/haswell/sut.yaml new file mode 100644 index 0000000000..b1b55859fd --- /dev/null +++ b/resources/tools/testbed-setup/ansible/group_vars/haswell/sut.yaml @@ -0,0 +1,4 @@ +--- +# file: group_vars/haswell/sut.yaml + +isolcpus: "1-17,19-35" diff --git a/resources/tools/testbed-setup/ansible/group_vars/haswell/tg.yaml b/resources/tools/testbed-setup/ansible/group_vars/haswell/tg.yaml new file mode 100644 index 0000000000..1242115e98 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/group_vars/haswell/tg.yaml @@ -0,0 +1,4 @@ +--- +# file: group_vars/haswell/tg.yaml + +isolcpus: "1-17,19-35" diff --git a/resources/tools/testbed-setup/ansible/group_vars/skylake/sut.yaml b/resources/tools/testbed-setup/ansible/group_vars/skylake/sut.yaml new file mode 100644 index 0000000000..f5926abd94 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/group_vars/skylake/sut.yaml @@ -0,0 +1,4 @@ +--- +# file: group_vars/skylake/sut.yaml + +isolcpus: "1-27,29-55,57-83,85-111" diff --git a/resources/tools/testbed-setup/ansible/group_vars/skylake/tg.yaml b/resources/tools/testbed-setup/ansible/group_vars/skylake/tg.yaml new file mode 100644 index 0000000000..7ea3ec3c9e --- /dev/null +++ b/resources/tools/testbed-setup/ansible/group_vars/skylake/tg.yaml @@ -0,0 +1,4 @@ +--- +# file: group_vars/skylake/tg.yaml + +isolcpus: "1-27,29-55,57-83,85-111" diff --git a/resources/tools/testbed-setup/ansible/host_vars/10.30.51.16.yaml b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.16.yaml new file mode 100644 index 0000000000..4407a51d9a --- /dev/null +++ b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.16.yaml @@ -0,0 +1,4 @@ +--- +# file: host_vars/10.30.51.16.yaml + +hostname: "t1-tg1" diff --git a/resources/tools/testbed-setup/ansible/host_vars/10.30.51.17.yaml b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.17.yaml new file mode 100644 index 0000000000..15ad8f7e1c --- /dev/null +++ b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.17.yaml @@ -0,0 +1,4 @@ +--- +# file: host_vars/10.30.51.17.yaml + +hostname: "t1-sut1" diff --git a/resources/tools/testbed-setup/ansible/host_vars/10.30.51.18.yaml b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.18.yaml new file mode 100644 index 0000000000..0d6528bf8f --- /dev/null +++ b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.18.yaml @@ -0,0 +1,4 @@ +--- +# file: host_vars/10.30.51.18.yaml + +hostname: "t1-sut2" diff --git a/resources/tools/testbed-setup/ansible/host_vars/10.30.51.20.yaml b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.20.yaml new file mode 100644 index 0000000000..fa3c25195b --- /dev/null +++ b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.20.yaml @@ -0,0 +1,4 @@ +--- +# file: host_vars/10.30.51.20.yaml + +hostname: "t2-tg1" diff --git a/resources/tools/testbed-setup/ansible/host_vars/10.30.51.21.yaml b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.21.yaml new file mode 100644 index 0000000000..4c9d91af2b --- /dev/null +++ b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.21.yaml @@ -0,0 +1,4 @@ +--- +# file: host_vars/10.30.51.21.yaml + +hostname: "t2-sut1" diff --git a/resources/tools/testbed-setup/ansible/host_vars/10.30.51.22.yaml b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.22.yaml new file mode 100644 index 0000000000..dc8f80e4ea --- /dev/null +++ b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.22.yaml @@ -0,0 +1,4 @@ +--- +# file: host_vars/10.30.51.22.yaml + +hostname: "t2-sut2" diff --git a/resources/tools/testbed-setup/ansible/host_vars/10.30.51.24.yaml b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.24.yaml new file mode 100644 index 0000000000..5d8fb50e04 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.24.yaml @@ -0,0 +1,4 @@ +--- +# file: host_vars/10.30.51.24.yaml + +hostname: "t3-tg1" diff --git a/resources/tools/testbed-setup/ansible/host_vars/10.30.51.25.yaml b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.25.yaml new file mode 100644 index 0000000000..c10ad67cce --- /dev/null +++ b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.25.yaml @@ -0,0 +1,4 @@ +--- +# file: host_vars/10.30.51.25.yaml + +hostname: "t3-sut1" diff --git a/resources/tools/testbed-setup/ansible/host_vars/10.30.51.26.yaml b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.26.yaml new file mode 100644 index 0000000000..9627a22a9b --- /dev/null +++ b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.26.yaml @@ -0,0 +1,4 @@ +--- +# file: host_vars/10.30.51.26.yaml + +hostname: "t3-sut2" diff --git a/resources/tools/testbed-setup/ansible/host_vars/10.30.51.28.yaml b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.28.yaml new file mode 100644 index 0000000000..11665983fa --- /dev/null +++ b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.28.yaml @@ -0,0 +1,10 @@ +--- +# file: host_vars/10.30.51.28.yaml + +hostname: "t4-virl1" +virl_l2_start: "10.30.52.2" +virl_l2_end: "10.30.52.253" +virl_l2_gateway: "10.30.52.1" +virl_l2_network: "10.30.52.0/24" +virl_l2_ip: "10.30.52.254" +virl_public_port: "eth0" diff --git a/resources/tools/testbed-setup/ansible/host_vars/10.30.51.29.yaml b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.29.yaml new file mode 100644 index 0000000000..4ab6fd1116 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.29.yaml @@ -0,0 +1,10 @@ +--- +# file: host_vars/10.30.51.29.yaml + +hostname: "t4-virl2" +virl_l2_start: "10.30.53.2" +virl_l2_end: "10.30.53.253" +virl_l2_gateway: "10.30.53.1" +virl_l2_network: "10.30.53.0/24" +virl_l2_ip: "10.30.53.254" +virl_public_port: "eth4" diff --git a/resources/tools/testbed-setup/ansible/host_vars/10.30.51.30.yaml b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.30.yaml new file mode 100644 index 0000000000..ab5d222188 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.30.yaml @@ -0,0 +1,10 @@ +--- +# file: host_vars/10.30.51.30.yaml + +hostname: "t4-virl3" +virl_l2_start: "10.30.54.2" +virl_l2_end: "10.30.54.253" +virl_l2_gateway: "10.30.54.1" +virl_l2_network: "10.30.54.0/24" +virl_l2_ip: "10.30.54.254" +virl_public_port: "eth0" diff --git a/resources/tools/testbed-setup/ansible/host_vars/10.30.51.44.yaml b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.44.yaml new file mode 100644 index 0000000000..4a3df38b9f --- /dev/null +++ b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.44.yaml @@ -0,0 +1,4 @@ +--- +# file: host_vars/10.30.51.44.yaml + +hostname: "s1-t21-sut1" diff --git a/resources/tools/testbed-setup/ansible/host_vars/10.30.51.45.yaml b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.45.yaml new file mode 100644 index 0000000000..77e69b39d3 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.45.yaml @@ -0,0 +1,4 @@ +--- +# file: host_vars/10.30.51.45.yaml + +hostname: "s2-t21-tg1" diff --git a/resources/tools/testbed-setup/ansible/host_vars/10.30.51.46.yaml b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.46.yaml new file mode 100644 index 0000000000..e63e1a1c7e --- /dev/null +++ b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.46.yaml @@ -0,0 +1,4 @@ +--- +# file: host_vars/10.30.51.46.yaml + +hostname: "s9-t31-sut1" diff --git a/resources/tools/testbed-setup/ansible/host_vars/10.30.51.47.yaml b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.47.yaml new file mode 100644 index 0000000000..d3f198ae8e --- /dev/null +++ b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.47.yaml @@ -0,0 +1,4 @@ +--- +# file: host_vars/10.30.51.47.yaml + +hostname: "s10-t31-sut2" diff --git a/resources/tools/testbed-setup/ansible/host_vars/10.30.51.48.yaml b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.48.yaml new file mode 100644 index 0000000000..2ec7289aed --- /dev/null +++ b/resources/tools/testbed-setup/ansible/host_vars/10.30.51.48.yaml @@ -0,0 +1,4 @@ +--- +# file: host_vars/10.30.51.48.yaml + +hostname: "s11-t31-tg1" diff --git a/resources/tools/testbed-setup/ansible/production b/resources/tools/testbed-setup/ansible/production new file mode 100644 index 0000000000..77bb20344c --- /dev/null +++ b/resources/tools/testbed-setup/ansible/production @@ -0,0 +1,39 @@ +all:
+ children:
+# haswell:
+# children:
+# tg:
+# hosts:
+# 10.30.51.16: null #t1-tg1
+# 10.30.51.20: null #t2-tg1
+# 10.30.51.24: null #t3-tg1
+# sut:
+# hosts:
+# 10.30.51.17: null #t1-sut1
+# 10.30.51.18: null #t1-sut2
+# 10.30.51.21: null #t2-sut1
+# 10.30.51.22: null #t2-sut2
+# 10.30.51.25: null #t3-sut1
+# 10.30.51.26: null #t3-sut2
+# virl: # WARNING, DO NOT ENABLE VIRL UNLESS YOU KNOW WHAT YOU ARE DOING
+# hosts:
+# 10.30.51.28: null #t4-virl1
+# 10.30.51.29: null #t4-virl2
+# 10.30.51.30: null #t4-virl3
+ skylake:
+ children:
+ tg:
+ hosts:
+ 10.30.51.45: null #s2-t21-tg1
+ 10.30.51.48: null #s11-t31-tg1
+ sut:
+ hosts:
+ 10.30.51.44: null #s1-t21-sut1
+ 10.30.51.46: null #s9-t31-sut1
+ 10.30.51.47: null #s10-t31-sut2
+# arm:
+# children:
+# tg:
+# hosts:
+# sut:
+# hosts:
diff --git a/resources/tools/testbed-setup/ansible/roles/common/files/apt-sources.list b/resources/tools/testbed-setup/ansible/roles/common/files/apt-sources.list new file mode 100644 index 0000000000..e8ccadfc64 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/common/files/apt-sources.list @@ -0,0 +1,61 @@ +# deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted + +# deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted +# deb http://security.ubuntu.com/ubuntu bionic-security main restricted + +# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to +# newer versions of the distribution. +deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted +deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main restricted + +## Major bug fix updates produced after the final release of the +## distribution. +deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted +deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted + +## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu +## team. Also, please note that software in universe WILL NOT receive any +## review or updates from the Ubuntu security team. +deb http://us.archive.ubuntu.com/ubuntu/ bionic universe +deb-src http://us.archive.ubuntu.com/ubuntu/ bionic universe +deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe +deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe + +## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu +## team, and may not be under a free licence. Please satisfy yourself as to +## your rights to use the software. Also, please note that software in +## multiverse WILL NOT receive any review or updates from the Ubuntu +## security team. +deb http://us.archive.ubuntu.com/ubuntu/ bionic multiverse +deb-src http://us.archive.ubuntu.com/ubuntu/ bionic multiverse +deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse +deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse + +## N.B. software from this repository may not have been tested as +## extensively as that contained in the main release, although it includes +## newer versions of some applications which may provide useful features. +## Also, please note that software in backports WILL NOT receive any review +## or updates from the Ubuntu security team. +deb http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse +deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse + +deb http://security.ubuntu.com/ubuntu bionic-security main restricted +deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted +deb http://security.ubuntu.com/ubuntu bionic-security universe +deb-src http://security.ubuntu.com/ubuntu bionic-security universe +deb http://security.ubuntu.com/ubuntu bionic-security multiverse +deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse + +## Uncomment the following two lines to add software from Canonical's +## 'partner' repository. +## This software is not part of Ubuntu, but is offered by Canonical and the +## respective vendors as a service to Ubuntu users. +# deb http://archive.canonical.com/ubuntu bionic partner +# deb-src http://archive.canonical.com/ubuntu bionic partner + +## Uncomment the following two lines to add software from Ubuntu's +## 'extras' repository. +## This software is not part of Ubuntu, but is offered by third-party +## developers who want to ship their latest software. +# deb http://extras.ubuntu.com/ubuntu bionic main +# deb-src http://extras.ubuntu.com/ubuntu bionic main diff --git a/resources/tools/testbed-setup/playbooks/files/grub b/resources/tools/testbed-setup/ansible/roles/common/files/grub index d4e27b3f0f..d4e27b3f0f 100644 --- a/resources/tools/testbed-setup/playbooks/files/grub +++ b/resources/tools/testbed-setup/ansible/roles/common/files/grub diff --git a/resources/tools/testbed-setup/ansible/roles/common/handlers/main.yaml b/resources/tools/testbed-setup/ansible/roles/common/handlers/main.yaml new file mode 100644 index 0000000000..bdcf6832f4 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/common/handlers/main.yaml @@ -0,0 +1,6 @@ +--- +# file: roles/common/handlers/main.yaml + +- name: Update GRUB + command: update-grub + tags: update-grub diff --git a/resources/tools/testbed-setup/ansible/roles/common/handlers/reboot.yaml b/resources/tools/testbed-setup/ansible/roles/common/handlers/reboot.yaml new file mode 100644 index 0000000000..01e1eb1b6b --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/common/handlers/reboot.yaml @@ -0,0 +1,14 @@ +--- +# file roles/common/handlers/reboot.yaml + +- name: Reboot host + command: shutdown -r now "Ansible updates triggered" + async: 0 + poll: 0 + ignore_errors: true + tags: reboot-host + +- name: Waiting for server to come back + local_action: wait_for host={{ inventory_hostname }} + state=started + tags: reboot-host diff --git a/resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml new file mode 100644 index 0000000000..e16a6a7356 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/common/tasks/main.yaml @@ -0,0 +1,46 @@ +---
+# file: roles/common/tasks/main.yaml
+
+- name: Ubuntu specific
+ import_tasks: ubuntu_x86_64.yaml
+ when: ansible_distribution|lower == 'ubuntu' and ansible_machine == 'x86_64'
+
+- name: Set hostname
+ hostname:
+ name: '{{ hostname }}'
+ tags: set-hostname
+
+- name: Ensure hostname is in /etc/hosts
+ lineinfile:
+ path: '/etc/hosts'
+ regexp: '^{{ ansible_default_ipv4.address }}.+$'
+ line: '{{ ansible_default_ipv4.address }} {{ hostname }}.linuxfoundation.org'
+ tags: set-hostname
+
+- name: Set sudoers
+ lineinfile:
+ path: '/etc/sudoers'
+ state: 'present'
+ regexp: '^%admin ALL='
+ line: '%admin ALL=(ALL) ALL'
+ validate: '/usr/sbin/visudo -cf %s'
+ tags: set-sudoers
+
+- name: Set sudoers
+ lineinfile:
+ path: '/etc/sudoers'
+ state: 'present'
+ regexp: '^%sudo'
+ line: '%sudo ALL=(ALL:ALL) NOPASSWD: ALL'
+ validate: '/usr/sbin/visudo -cf %s'
+ tags: set-sudoers
+
+- name: Copy grub file
+ template:
+ src: 'files/grub'
+ dest: '/etc/default/grub'
+ owner: 'root'
+ group: 'root'
+ mode: '644'
+ notify: ['Update GRUB']
+ tags: copy-grub
diff --git a/resources/tools/testbed-setup/ansible/roles/common/tasks/ubuntu_x86_64.yaml b/resources/tools/testbed-setup/ansible/roles/common/tasks/ubuntu_x86_64.yaml new file mode 100644 index 0000000000..d0f32a31cc --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/common/tasks/ubuntu_x86_64.yaml @@ -0,0 +1,50 @@ +---
+# file: roles/common/tasks/ubuntu_x86_64.yaml
+
+- name: Copy apt sources file
+ template:
+ src: 'files/apt-sources.list'
+ dest: '/etc/apt/sources.list'
+ tags: copy-apt-sources
+
+- name: Install python-apt
+ apt:
+ name: 'python-apt'
+ state: 'present'
+ update_cache: True
+ tags: install-python-apt
+
+- name: Install git
+ apt:
+ name: 'git'
+ state: 'present'
+ update_cache: True
+ tags: install-git
+
+- name: Install crudini
+ apt:
+ name: 'crudini'
+ state: 'present'
+ update_cache: True
+ tags: install-crudini
+
+- name: Install expect
+ apt:
+ name: 'expect'
+ state: 'present'
+ update_cache: True
+ tags: install-expect
+
+- name: Install socat
+ apt:
+ name: 'socat'
+ state: 'present'
+ update_cache: True
+ tags: install-socat
+
+- name: Install qemu
+ apt:
+ name: 'qemu-system-x86'
+ state: 'present'
+ update_cache: True
+ tags: install-qemu
diff --git a/resources/tools/testbed-setup/ansible/roles/sut/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/sut/tasks/main.yaml new file mode 100644 index 0000000000..ffdbbcc860 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/sut/tasks/main.yaml @@ -0,0 +1,14 @@ +---
+# file: roles/sut/tasks/main.yaml
+
+- name: Ubuntu specific
+ import_tasks: ubuntu_x86_64.yaml
+ when: ansible_distribution|lower == 'ubuntu' and ansible_machine == 'x86_64'
+
+- name: Copy 80-vpp.conf
+ file:
+ src: '/dev/null'
+ dest: '/etc/sysctl.d/80-vpp.conf'
+ state: 'link'
+ become: yes
+ tags: copy-80-vpp
diff --git a/resources/tools/testbed-setup/ansible/roles/sut/tasks/ubuntu_x86_64.yaml b/resources/tools/testbed-setup/ansible/roles/sut/tasks/ubuntu_x86_64.yaml new file mode 100644 index 0000000000..f9ab901ded --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/sut/tasks/ubuntu_x86_64.yaml @@ -0,0 +1,90 @@ +---
+# file: roles/sut/tasks/ubuntu_x86_64.yaml
+
+- name: Install DKMS
+ apt:
+ name: 'dkms'
+ state: 'present'
+ update_cache: True
+ become: yes
+ tags: install-dkms
+
+- name: Install pkg-config
+ apt:
+ name: 'pkg-config'
+ state: 'present'
+ update_cache: True
+ become: yes
+ tags: install-pkg-config
+
+- name: Install libglib2.0-dev
+ apt:
+ name: 'libglib2.0-dev'
+ state: 'present'
+ update_cache: True
+ become: yes
+ tags: install-libglib2.0-dev
+
+- name: Install autoconf
+ apt:
+ name: 'autoconf'
+ state: 'present'
+ update_cache: True
+ become: yes
+ tags: install-autoconf
+
+- name: Install libtool
+ apt:
+ name: 'libtool'
+ state: 'present'
+ update_cache: True
+ become: yes
+ tags: install-libtool
+
+- name: Install screen
+ apt:
+ name: 'screen'
+ state: 'present'
+ update_cache: True
+ become: yes
+ tags: install-screen
+
+- name: Install libmbedcrypto1
+ apt:
+ name: 'libmbedcrypto1'
+ state: 'present'
+ update_cache: True
+ become: yes
+ tags: install-libmbedcrypto1
+
+- name: Install libmbedtls10
+ apt:
+ name: 'libmbedtls10'
+ state: 'present'
+ update_cache: True
+ become: yes
+ tags: install-libmbedtls10
+
+- name: Install libmbedx509-0
+ apt:
+ name: 'libmbedx509-0'
+ state: 'present'
+ update_cache: True
+ become: yes
+ tags: install-libmbedx509-0
+
+- name: Install lxc
+ apt:
+ name: 'lxc'
+ state: 'present'
+ update_cache: True
+ become: yes
+ tags: install-lxc
+
+- name: Install java
+ apt:
+ name: 'openjdk-8-jdk'
+ state: 'present'
+ update_cache: True
+ become: yes
+ tags: install-java
diff --git a/resources/tools/testbed-setup/ansible/roles/tg/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/tg/tasks/main.yaml new file mode 100644 index 0000000000..8e71800bca --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/tg/tasks/main.yaml @@ -0,0 +1,6 @@ +---
+# file: roles/tg/tasks/main.yaml
+
+- name: Ubuntu specific
+ import_tasks: ubuntu_x86_64.yaml
+ when: ansible_distribution|lower == 'ubuntu' and ansible_machine == 'x86_64'
diff --git a/resources/tools/testbed-setup/ansible/roles/tg/tasks/ubuntu_x86_64.yaml b/resources/tools/testbed-setup/ansible/roles/tg/tasks/ubuntu_x86_64.yaml new file mode 100644 index 0000000000..9711b2678d --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/tg/tasks/ubuntu_x86_64.yaml @@ -0,0 +1,9 @@ +---
+# file: roles/tg/tasks/ubuntu_x86_64.yaml
+
+- name: Install Unzip
+ apt:
+ name: 'unzip'
+ state: 'present'
+ update_cache: True
+ tags: install-unzip
diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/defaults/main.yaml b/resources/tools/testbed-setup/ansible/roles/tg_sut/defaults/main.yaml new file mode 100644 index 0000000000..cefc496107 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/tg_sut/defaults/main.yaml @@ -0,0 +1,30 @@ +--- +docker_edition: "ce" +docker_channel: "edge" + +docker_version: "18.05.0" +docker_install_docker_compose: True +docker_compose_version: "1.21.0" + +docker_users: ['testuser'] + +docker_daemon_options: [] +# Can be used to set environment variables for the Docker daemon, such as: +# docker_daemon_environment: +# - "HTTP_PROXY=http://proxy.example.com:3128/" +# - "HTTPS_PROXY=http://proxy.example.com:3128/" +# - "NO_PROXY=localhost,127.0.0.1" +docker_daemon_environment: [] + +docker_apt_key: "9DC858229FC7DD38854AE2D88D81803C0EBFCD88" +docker_repository: "deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} {{ docker_channel }}" +docker_apt_package_name: "{{ docker_version }}~{{ docker_edition }}~3-0~{{ ansible_distribution | lower }}" + +apt_cache_time: 86400 + +kubernetes_channel: "main" +kubernetes_version: "1.10.3" + +kubernetes_apt_key: "54A647F9048D5688D7DA2ABE6A030B21BA07F4FB" +kubernetes_repository: "deb http://apt.kubernetes.io/ kubernetes-xenial {{ kubernetes_channel }}" +kubernetes_apt_package_name: "{{ kubernetes_version }}-00" diff --git a/resources/tools/testbed-setup/playbooks/files/90-csit b/resources/tools/testbed-setup/ansible/roles/tg_sut/files/90-csit index 2304162ce8..2304162ce8 100644 --- a/resources/tools/testbed-setup/playbooks/files/90-csit +++ b/resources/tools/testbed-setup/ansible/roles/tg_sut/files/90-csit diff --git a/resources/tools/testbed-setup/playbooks/files/cpufrequtils b/resources/tools/testbed-setup/ansible/roles/tg_sut/files/cpufrequtils index 03070fefe1..03070fefe1 100644 --- a/resources/tools/testbed-setup/playbooks/files/cpufrequtils +++ b/resources/tools/testbed-setup/ansible/roles/tg_sut/files/cpufrequtils diff --git a/resources/tools/testbed-setup/playbooks/files/interfaces_physical b/resources/tools/testbed-setup/ansible/roles/tg_sut/files/interfaces_physical index 734d8cd18f..734d8cd18f 100644 --- a/resources/tools/testbed-setup/playbooks/files/interfaces_physical +++ b/resources/tools/testbed-setup/ansible/roles/tg_sut/files/interfaces_physical diff --git a/resources/tools/testbed-setup/playbooks/files/irqbalance b/resources/tools/testbed-setup/ansible/roles/tg_sut/files/irqbalance index 84fb5f17e2..84fb5f17e2 100644 --- a/resources/tools/testbed-setup/playbooks/files/irqbalance +++ b/resources/tools/testbed-setup/ansible/roles/tg_sut/files/irqbalance diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/files/requirements.txt b/resources/tools/testbed-setup/ansible/roles/tg_sut/files/requirements.txt new file mode 100644 index 0000000000..11caf5d563 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/tg_sut/files/requirements.txt @@ -0,0 +1,13 @@ +robotframework==2.9.2 +paramiko==1.16.0 +scp==0.10.2 +ipaddress==1.0.16 +interruptingcow==0.6 +PyYAML==3.11 +pykwalify==1.5.0 +scapy==2.3.1 +enum34==1.1.2 +requests==2.9.1 +ecdsa==0.13 +pycrypto==2.6.1 +pypcap==1.1.5 diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/handlers/main.yaml b/resources/tools/testbed-setup/ansible/roles/tg_sut/handlers/main.yaml new file mode 100644 index 0000000000..15a6803671 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/tg_sut/handlers/main.yaml @@ -0,0 +1,8 @@ +--- +# file roles/tg_sut/handlers/main.yaml + +- name: Restart Docker + service: + name: 'docker' + state: 'restarted' + tags: restart-docker diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml new file mode 100644 index 0000000000..c8454f58c6 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/main.yaml @@ -0,0 +1,68 @@ +---
+# file: roles/tg_sut/tasks/main.yaml
+
+- name: Ubuntu specific
+ import_tasks: ubuntu_x86_64.yaml
+ when: ansible_distribution|lower == 'ubuntu' and ansible_machine == 'x86_64'
+
+- name: Copy interfaces file
+ template:
+ src: 'files/interfaces_physical'
+ dest: '/etc/network/interfaces'
+ owner: 'root'
+ group: 'root'
+ mode: '0644'
+ tags: copy-interface-file
+
+- name: Copy sysctl file
+ template:
+ src: 'files/90-csit'
+ dest: '/etc/sysctl.d/90-csit.conf'
+ owner: 'root'
+ group: 'root'
+ mode: '0644'
+ tags: copy-90-csit
+
+- name: Copy IRQ load balancing file
+ copy:
+ src: 'files/irqbalance'
+ dest: '/etc/default/irqbalance'
+ owner: 'root'
+ group: 'root'
+ mode: '0644'
+ tags: copy-irq
+
+- name: Copy cpufrequtils file
+ copy:
+ src: 'files/cpufrequtils'
+ dest: '/etc/default/cpufrequtils'
+ owner: 'root'
+ group: 'root'
+ mode: '0644'
+ tags: copy-cpufrequtils
+
+- name: Copy Python requirements file
+ copy:
+ src: 'files/requirements.txt'
+ dest: '/tmp/requirements.txt'
+ tags: copy-pip
+
+- name: Set isolcpus and pstate parameter
+ lineinfile:
+ path: '/etc/default/grub'
+ state: 'present'
+ regexp: '^GRUB_CMDLINE_LINUX='
+ line: 'GRUB_CMDLINE_LINUX="isolcpus={{ isolcpus }} nohz_full={{ isolcpus }} rcu_nocbs={{ isolcpus }} intel_pstate=disable"'
+ notify: ['Update GRUB']
+ tags: set-grub
+
+- name: Set ondemand service to disable
+ service:
+ name: 'ondemand'
+ enabled: 'no'
+ tags: set-ondemand
+
+- name: Install PIP requirements
+ pip:
+ requirements: '/tmp/requirements.txt'
+ tags: install-pip
diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/ubuntu_x86_64.yaml b/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/ubuntu_x86_64.yaml new file mode 100644 index 0000000000..3c6eb10d62 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/tg_sut/tasks/ubuntu_x86_64.yaml @@ -0,0 +1,182 @@ +---
+# file: roles/tg_sut/tasks/ubuntu_x86_64.yaml
+
+- name: Install python-dev
+ apt:
+ name: 'python-dev'
+ state: 'present'
+ update_cache: True
+ tags: install-python-dev
+
+- name: Install python-virtualenv
+ apt:
+ name: 'python-virtualenv'
+ state: 'present'
+ update_cache: True
+ tags: install-python-virtualenv
+
+- name: Install python pip
+ apt:
+ name: 'python-pip'
+ state: 'present'
+ update_cache: True
+ tags: install-python-pip
+
+- name: Install libpcap-dev
+ apt:
+ name: 'libpcap-dev'
+ state: 'present'
+ update_cache: True
+ tags: install-libpcap-dev
+
+- name: Install cpufrequtils
+ apt:
+ name: 'cpufrequtils'
+ state: 'present'
+ update_cache: True
+ tags: install-cpufrequtils
+
+- name: Install cgroup-support
+ apt:
+ name: 'cgroup-bin'
+ state: 'present'
+ update_cache: True
+ tags: install-cgroup-support
+
+- name: Install zlib1g-dev
+ apt:
+ name: 'zlib1g-dev'
+ state: 'present'
+ update_cache: True
+ tags: install-zlib1g-dev
+
+- name: Install libnuma-dev
+ apt:
+ name: 'libnuma-dev'
+ state: 'present'
+ update_cache: True
+ tags: install-libnuma-dev
+
+- name: Install Docker and role dependencies
+ apt:
+ name: "{{ item }}"
+ state: "present"
+ install_recommends: False
+ with_items:
+ - "apt-transport-https"
+ - "ca-certificates"
+ - "software-properties-common"
+ - "cron"
+ tags: install-docker
+
+- name: Install upstream APT GPG key
+ apt_key:
+ id: "{{ docker_apt_key }}"
+ keyserver: "{{ ansible_local.core.keyserver
+ if (ansible_local|d() and ansible_local.core|d() and
+ ansible_local.core.keyserver)
+ else 'hkp://pool.sks-keyservers.net' }}"
+ state: "present"
+ tags: install-docker
+
+- name: Install upstream APT repository
+ apt_repository:
+ repo: "{{ docker_repository }}"
+ state: "present"
+ update_cache: True
+ tags: install-docker
+
+- name: Install Docker
+ apt:
+ name: "docker-{{ docker_edition }}={{ docker_apt_package_name }}"
+ state: "present"
+ update_cache: True
+ install_recommends: False
+ cache_valid_time: "{{ apt_cache_time }}"
+ tags: install-docker
+
+- name: Remove Upstart config file
+ file:
+ path: "/etc/default/docker"
+ state: "absent"
+ tags: docker
+
+- name: Ensure systemd directory exists
+ file:
+ path: "/etc/systemd/system"
+ state: "directory"
+ owner: "root"
+ group: "root"
+ mode: "0755"
+ tags: ensure-docker
+
+- name: Copy systemd unit file
+ template:
+ src: "templates/docker.service.j2"
+ dest: "/etc/systemd/system/docker.service"
+ owner: "root"
+ group: "root"
+ mode: "0644"
+ register: docker_register_systemd_service
+ tags: copy-docker
+
+- name: Reload systemd daemon
+ command: "systemctl daemon-reload"
+ notify: ["Restart Docker"]
+ when: (docker_register_systemd_service and
+ docker_register_systemd_service | changed)
+ tags: restart-docker
+
+- name: Set specific users to "docker" group
+ user:
+ name: "{{ item }}"
+ groups: "docker"
+ append: True
+ with_items: "{{ docker_users }}"
+ when: docker_users
+ tags: set-docker
+
+- name: Install upstream APT GPG key
+ apt_key:
+ id: "{{ kubernetes_apt_key }}"
+ keyserver: "{{ ansible_local.core.keyserver
+ if (ansible_local|d() and ansible_local.core|d() and
+ ansible_local.core.keyserver)
+ else 'hkp://pool.sks-keyservers.net' }}"
+ state: "present"
+ tags: install-kubernetes
+
+- name: Install upstream APT repository
+ apt_repository:
+ repo: "{{ kubernetes_repository }}"
+ state: "present"
+ update_cache: True
+ tags: install-kubernetes
+
+- name: Install kubeadm
+ apt:
+ name: "kubeadm={{ kubernetes_apt_package_name }}"
+ state: "present"
+ update_cache: True
+ install_recommends: False
+ cache_valid_time: "{{ apt_cache_time }}"
+ tags: install-kubernetes
+
+- name: Install kubectl
+ apt:
+ name: "kubectl={{ kubernetes_apt_package_name }}"
+ state: "present"
+ update_cache: True
+ install_recommends: False
+ cache_valid_time: "{{ apt_cache_time }}"
+ tags: install-kubernetes
+
+- name: Install kubelet
+ apt:
+ name: "kubelet={{ kubernetes_apt_package_name }}"
+ state: "present"
+ update_cache: True
+ install_recommends: False
+ cache_valid_time: "{{ apt_cache_time }}"
+ tags: install-kubernetes
+
diff --git a/resources/tools/testbed-setup/ansible/roles/tg_sut/templates/docker.service.j2 b/resources/tools/testbed-setup/ansible/roles/tg_sut/templates/docker.service.j2 new file mode 100644 index 0000000000..26a1bcf372 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/tg_sut/templates/docker.service.j2 @@ -0,0 +1,34 @@ +# {{ ansible_managed }} + +[Unit] +Description=Docker Application Container Engine +Documentation=https://docs.docker.com +After=network-online.target docker.socket +Requires=docker.socket + +[Service] +Type=notify +# the default is not to use systemd for cgroups because the delegate issues still +# exists and systemd currently does not support the cgroup feature set required +# for containers run by docker +{% if docker_daemon_environment %} +Environment="{{ docker_daemon_environment | join('" "') }}" +{% endif %} +ExecStart=/usr/bin/dockerd {{ docker_daemon_options | join(" ") }} +ExecReload=/bin/kill -s HUP $MAINPID +# Having non-zero Limit*s causes performance problems due to accounting overhead +# in the kernel. We recommend using cgroups to do container-local accounting. +LimitNOFILE=infinity +LimitNPROC=infinity +LimitCORE=infinity +# Uncomment TasksMax if your systemd version supports it. +# Only systemd 226 and above support this version. +TasksMax=infinity +TimeoutStartSec=0 +# set delegate yes so that systemd does not reset the cgroups of docker containers +Delegate=yes +# kill only the docker process, not all processes in the cgroup +KillMode=process + +[Install] +WantedBy=multi-user.target diff --git a/resources/tools/testbed-setup/playbooks/files/interfaces_virl b/resources/tools/testbed-setup/ansible/roles/virl/files/interfaces_virl index 25ea35a0c5..25ea35a0c5 100644 --- a/resources/tools/testbed-setup/playbooks/files/interfaces_virl +++ b/resources/tools/testbed-setup/ansible/roles/virl/files/interfaces_virl diff --git a/resources/tools/testbed-setup/playbooks/files/nova_os_ip.patch b/resources/tools/testbed-setup/ansible/roles/virl/files/nova_os_ip.patch index a943dc9b25..a943dc9b25 100644 --- a/resources/tools/testbed-setup/playbooks/files/nova_os_ip.patch +++ b/resources/tools/testbed-setup/ansible/roles/virl/files/nova_os_ip.patch diff --git a/resources/tools/testbed-setup/ansible/roles/virl/files/requirements.txt b/resources/tools/testbed-setup/ansible/roles/virl/files/requirements.txt new file mode 100644 index 0000000000..11caf5d563 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/virl/files/requirements.txt @@ -0,0 +1,13 @@ +robotframework==2.9.2 +paramiko==1.16.0 +scp==0.10.2 +ipaddress==1.0.16 +interruptingcow==0.6 +PyYAML==3.11 +pykwalify==1.5.0 +scapy==2.3.1 +enum34==1.1.2 +requests==2.9.1 +ecdsa==0.13 +pycrypto==2.6.1 +pypcap==1.1.5 diff --git a/resources/tools/testbed-setup/playbooks/files/salt.b64 b/resources/tools/testbed-setup/ansible/roles/virl/files/salt.b64 index 5e76a8583b..5e76a8583b 100644 --- a/resources/tools/testbed-setup/playbooks/files/salt.b64 +++ b/resources/tools/testbed-setup/ansible/roles/virl/files/salt.b64 diff --git a/resources/tools/testbed-setup/playbooks/files/salt/etc/salt/minion.d/testlocal.conf b/resources/tools/testbed-setup/ansible/roles/virl/files/salt/etc/salt/minion.d/testlocal.conf index fce910cc0b..fce910cc0b 100644 --- a/resources/tools/testbed-setup/playbooks/files/salt/etc/salt/minion.d/testlocal.conf +++ b/resources/tools/testbed-setup/ansible/roles/virl/files/salt/etc/salt/minion.d/testlocal.conf diff --git a/resources/tools/testbed-setup/playbooks/files/salt/srv/salt/ckoester/nfs-server.sls b/resources/tools/testbed-setup/ansible/roles/virl/files/salt/srv/salt/ckoester/nfs-server.sls index bf3e47f9b3..bf3e47f9b3 100644 --- a/resources/tools/testbed-setup/playbooks/files/salt/srv/salt/ckoester/nfs-server.sls +++ b/resources/tools/testbed-setup/ansible/roles/virl/files/salt/srv/salt/ckoester/nfs-server.sls diff --git a/resources/tools/testbed-setup/playbooks/files/salt/srv/salt/ckoester/nfs-server/configure.sls b/resources/tools/testbed-setup/ansible/roles/virl/files/salt/srv/salt/ckoester/nfs-server/configure.sls index ce362a38b2..ce362a38b2 100644 --- a/resources/tools/testbed-setup/playbooks/files/salt/srv/salt/ckoester/nfs-server/configure.sls +++ b/resources/tools/testbed-setup/ansible/roles/virl/files/salt/srv/salt/ckoester/nfs-server/configure.sls diff --git a/resources/tools/testbed-setup/playbooks/files/salt/srv/salt/ckoester/nfs-server/files/exports b/resources/tools/testbed-setup/ansible/roles/virl/files/salt/srv/salt/ckoester/nfs-server/files/exports index 23802be486..23802be486 100644 --- a/resources/tools/testbed-setup/playbooks/files/salt/srv/salt/ckoester/nfs-server/files/exports +++ b/resources/tools/testbed-setup/ansible/roles/virl/files/salt/srv/salt/ckoester/nfs-server/files/exports diff --git a/resources/tools/testbed-setup/playbooks/files/salt/srv/salt/ckoester/nfs-server/install.sls b/resources/tools/testbed-setup/ansible/roles/virl/files/salt/srv/salt/ckoester/nfs-server/install.sls index 0f136346f8..0f136346f8 100644 --- a/resources/tools/testbed-setup/playbooks/files/salt/srv/salt/ckoester/nfs-server/install.sls +++ b/resources/tools/testbed-setup/ansible/roles/virl/files/salt/srv/salt/ckoester/nfs-server/install.sls diff --git a/resources/tools/testbed-setup/playbooks/files/sudoers_jenkins-in b/resources/tools/testbed-setup/ansible/roles/virl/files/sudoers_jenkins-in index 1797c2c636..1797c2c636 100644 --- a/resources/tools/testbed-setup/playbooks/files/sudoers_jenkins-in +++ b/resources/tools/testbed-setup/ansible/roles/virl/files/sudoers_jenkins-in diff --git a/resources/tools/testbed-setup/playbooks/files/sudoers_virl b/resources/tools/testbed-setup/ansible/roles/virl/files/sudoers_virl index e0cf48ac10..e0cf48ac10 100644 --- a/resources/tools/testbed-setup/playbooks/files/sudoers_virl +++ b/resources/tools/testbed-setup/ansible/roles/virl/files/sudoers_virl diff --git a/resources/tools/testbed-setup/playbooks/files/ttyS0 b/resources/tools/testbed-setup/ansible/roles/virl/files/ttyS0 index 0ed8550190..0ed8550190 100644 --- a/resources/tools/testbed-setup/playbooks/files/ttyS0 +++ b/resources/tools/testbed-setup/ansible/roles/virl/files/ttyS0 diff --git a/resources/tools/testbed-setup/playbooks/files/virl/id_rsa_virl b/resources/tools/testbed-setup/ansible/roles/virl/files/virl/id_rsa_virl index b4c3de745b..b4c3de745b 100644 --- a/resources/tools/testbed-setup/playbooks/files/virl/id_rsa_virl +++ b/resources/tools/testbed-setup/ansible/roles/virl/files/virl/id_rsa_virl diff --git a/resources/tools/testbed-setup/playbooks/files/virl/id_rsa_virl.pub b/resources/tools/testbed-setup/ansible/roles/virl/files/virl/id_rsa_virl.pub index 0ef508c8a1..0ef508c8a1 100644 --- a/resources/tools/testbed-setup/playbooks/files/virl/id_rsa_virl.pub +++ b/resources/tools/testbed-setup/ansible/roles/virl/files/virl/id_rsa_virl.pub diff --git a/resources/tools/testbed-setup/playbooks/files/virl/ifup b/resources/tools/testbed-setup/ansible/roles/virl/files/virl/ifup index a4a743ac63..a4a743ac63 100755..100644 --- a/resources/tools/testbed-setup/playbooks/files/virl/ifup +++ b/resources/tools/testbed-setup/ansible/roles/virl/files/virl/ifup diff --git a/resources/tools/testbed-setup/playbooks/files/virl/ssh_environment b/resources/tools/testbed-setup/ansible/roles/virl/files/virl/ssh_environment index 5ec594d181..5ec594d181 100644 --- a/resources/tools/testbed-setup/playbooks/files/virl/ssh_environment +++ b/resources/tools/testbed-setup/ansible/roles/virl/files/virl/ssh_environment diff --git a/resources/tools/testbed-setup/playbooks/files/virl/virl-bootstrap-wrapper b/resources/tools/testbed-setup/ansible/roles/virl/files/virl/virl-bootstrap-wrapper index dc7ead804d..dc7ead804d 100644 --- a/resources/tools/testbed-setup/playbooks/files/virl/virl-bootstrap-wrapper +++ b/resources/tools/testbed-setup/ansible/roles/virl/files/virl/virl-bootstrap-wrapper diff --git a/resources/tools/testbed-setup/playbooks/02-virl-bootstrap.yaml b/resources/tools/testbed-setup/ansible/roles/virl/tasks/02-virl-bootstrap.yaml index 938a2da454..9ffb40caaf 100644 --- a/resources/tools/testbed-setup/playbooks/02-virl-bootstrap.yaml +++ b/resources/tools/testbed-setup/ansible/roles/virl/tasks/02-virl-bootstrap.yaml @@ -1,115 +1,216 @@ --- -- hosts: virl - remote_user: virl - tasks: - name: install virl-bootstrap git: repo: 'https://github.com/VIRL-Open/virl-bootstrap.git' dest: /home/virl/virl-bootstrap version: xenial + become_user: virl - name: copy vsetting file to /etc - sudo: yes shell: /usr/bin/install -m 666 /home/virl/virl-bootstrap/vsettings.ini /etc/virl.ini + become: yes + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT hostname {{ hostname }} + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT domain_name linuxfoundation.org + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT using_dhcp_on_the_public_port False + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT public_port dummy3 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT Static_IP 10.30.49.28 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT public_network 10.30.49.0 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT public_netmask {{ ansible_default_ipv4["netmask"] }} + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT public_gateway 10.30.49.1 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT proxy False + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT ntp_server pool.ntp.org + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT first_nameserver 199.204.44.24 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT second_nameserver 199.204.47.54 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT salt_master vsm-md.virl.info + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT salt_id {{ hostname }} + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT salt_domain linuxfoundation.org + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT salt_masterless false + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l2_port {{ virl_public_port }} + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l2_network {{ virl_l2_network }} + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l2_mask 255.255.255.0 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l2_network_gateway {{ virl_l2_gateway }} + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l2_start_address {{ virl_l2_start }} + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l2_end_address {{ virl_l2_end }} + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l2_address {{ ansible_default_ipv4["address"] }}/24 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT first_flat_nameserver 199.204.44.24 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT second_flat_nameserver 199.204.47.54 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l2_port2_enabled True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l2_port2 dummy0 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l2_network2 172.16.2.0/24 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l2_mask2 255.255.255.0 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l2_network_gateway2 172.16.2.1 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l2_start_address2 172.16.2.50 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l2_end_address2 172.16.2.253 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l2_address2 172.16.2.254/24 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT first_flat2_nameserver 199.204.44.24 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT second_flat2_nameserver 199.204.47.54 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l3_port dummy1 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l3_network 172.16.3.0/24 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l3_mask 255.255.255.0 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l3_network_gateway 172.16.3.1 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l3_floating_start_address 172.16.3.50 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l3_floating_end_address 172.16.3.253 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT l3_address 172.16.3.254/24 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT first_snat_nameserver 199.204.44.24 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT second_snat_nameserver 199.204.47.54 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT ramdisk True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT ank 19401 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT ank_live 19402 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT virl_webservices 19399 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT virl_user_management 19400 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT virl_apache_port 80 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT virl_webmux 19403 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT Start_of_serial_port_range 17000 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT End_of_serial_port_range 18000 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT serial_port 19406 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT vnc_port 19407 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT location_region US + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT vnc False + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT guest_account True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT user_list tb4-virl:Cisco1234 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT uwmadmin_password Cisco1234 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT password password + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT mysql_password password + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT keystone_service_token fkgjhsdflkjh + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT enable_cinder True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT cinder_file True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT cinder_size 20000 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT cinder_location /var/lib/cinder/cinder-volumes.lvm + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT dummy_int True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT this_node_is_the_controller True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT internalnet_controller_hostname controller + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT internalnet_controller_IP 172.16.10.250 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT internalnet_port dummy2 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT internalnet_IP 172.16.10.250 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT internalnet_network 172.16.10.0 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT internalnet_netmask 255.255.255.0 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT internalnet_gateway 172.16.10.1 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT iosv True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT csr1000v True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT iosxrv432 False + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT iosxrv52 False + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT iosxrv True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT nxosv True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT vpagent True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT iosvl2 True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT asav True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT lxc_server True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT lxc_iperf True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT lxc_routem True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT lxc_ostinato True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT server True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT vmm_mac True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT vmm_win32 True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT vmm_win64 True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT vmm_linux True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT virl_clients True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT ram_overcommit 2 + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT web_editor True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT mitaka True + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT kilo False + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT libvirt_cpu_mode host-passthrough + become_user: virl - command: crudini --inplace --set /etc/virl.ini DEFAULT neutron_bridge_flooding True + become_user: virl - name: copy vinstall bootstrap wrapper script template: src=files/virl/virl-bootstrap-wrapper dest=/home/virl/virl-bootstrap/virl-bootstrap-wrapper owner=virl group=virl mode=775 + become_user: virl diff --git a/resources/tools/testbed-setup/playbooks/03-virl-post-install.yaml b/resources/tools/testbed-setup/ansible/roles/virl/tasks/03-virl-post-install.yaml index c31e1a3f1d..44b9df2098 100644 --- a/resources/tools/testbed-setup/playbooks/03-virl-post-install.yaml +++ b/resources/tools/testbed-setup/ansible/roles/virl/tasks/03-virl-post-install.yaml @@ -1,8 +1,4 @@ --- -- hosts: virl - remote_user: testuser - sudo: yes - tasks: - name: Add jenkins-in user user: name=jenkins-in shell=/bin/bash comment="Jenkins user" - name: Add jenkins-in user to sudoers @@ -29,49 +25,56 @@ lineinfile: dest=/etc/ssh/sshd_config state=present regexp='PermitUserEnvironment.*' line='PermitUserEnvironment yes' - name: Restart SSH daemon service: name=ssh state=restarted -- hosts: virl - remote_user: jenkins-in - tasks: - name: clone csit git repository git: repo=https://gerrit.fd.io/r/csit dest=/home/jenkins-in/git/csit + become: jenkins-in - name: Link testcase-infra directory command: ln -sf /home/jenkins-in/git/csit/resources/tools/virl /home/jenkins-in/testcase-infra args: creates: /home/jenkins-in/testcase-infra + become: jenkins-in - name: Create bin directory file: path=/home/jenkins-in/bin state=directory mode=0755 + become: jenkins-in - name: Link start-testcase executable command: ln -sf /home/jenkins-in/testcase-infra/bin/start-testcase /home/jenkins-in/bin/start-testcase args: creates: /home/jenkins-in/bin/start-testcase + become: jenkins-in - name: Link stop-testcase executable command: ln -sf /home/jenkins-in/testcase-infra/bin/stop-testcase /home/jenkins-in/bin/stop-testcase args: creates: /home/jenkins-in/bin/stop-testcase + become: jenkins-in - name: Link kill-idle-testcases executable command: ln -sf /home/jenkins-in/testcase-infra/bin/kill-idle-testcases /home/jenkins-in/bin/kill-idle-testcases args: creates: /home/jenkins-in/bin/kill-idle-testcases + become: jenkins-in - name: Copy SSH private key copy: src=files/virl/id_rsa_virl dest=/home/jenkins-in/.ssh/id_rsa_virl mode=600 + become: jenkins-in - name: Copy SSH public key copy: src=files/virl/id_rsa_virl.pub dest=/home/jenkins-in/.ssh/id_rsa_virl.pub mode=644 + become: jenkins-in - name: Copy SSH environment copy: src=files/virl/ssh_environment dest=/home/jenkins-in/.ssh/environment mode=644 + become: jenkins-in - name: Add ~/bin to path lineinfile: dest=/home/jenkins-in/.bashrc state=present line='PATH=${HOME}/bin:$PATH' + become: jenkins-in - name: Update own IP address in start script shell: sed -i /home/jenkins-in/testcase-infra/bin/start-testcase -e 's/10.30.51.28/{{ ansible_default_ipv4["address"] }}/' + become: jenkins-in - name: Add authorized key lineinfile: dest=/home/jenkins-in/.ssh/authorized_keys line='ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD4gderzsZyoxHULjuvPHoJuKnkaGrykqtuoqs/k1/jUdxitPoY5eX2cVYqww7MiUif7zLsiXbt5mHtyxAYCluDxAuIcy1xgSZY3MpmmSqDie4A/FdVfCUqCcpf3TZKsRP0an1MNrKIe0JFZV+uU889IDRQRdboGMs3+4cn5b9fOutpv71qwFVrTm9PZbqfQonrrN8Jp4Mz3XaZDpK22xwDAWhYOZ0eV6CJWquUgbYAHE6/HHMvd0zeJKaWZCXO/1tOGOj6cjgoViHqbnCtmYCjmv/ir0IglzbUdWdOqQY5YkhnPonveV48lVKrmBipqgbDezAUQD8wOQ7HttpYpKgt jenkins-in@tb4-virl' + become: jenkins-in # All of the below will fail if VIRL user/project already exist -- hosts: virl - remote_user: virl - tasks: - name: Create VIRL project shell: virl_uwm_client project-edit --name tb4-virl --enabled True -i 400 -r 1024000 -c 500 ignore_errors: true + become: virl # - name: Delete VIRL project user # shell: virl_uwm_client user-delete --name tb4-virl # ignore_errors: true @@ -81,3 +84,4 @@ - name: Create VPP flavor shell: virl_uwm_client flavor-create --name vPP --ram 4096 --vcpus 2 --disk 0 ignore_errors: true + become: virl diff --git a/resources/tools/testbed-setup/playbooks/04-disk-image.yaml b/resources/tools/testbed-setup/ansible/roles/virl/tasks/04-disk-image.yaml index fe069375c6..254c05e709 100644 --- a/resources/tools/testbed-setup/playbooks/04-disk-image.yaml +++ b/resources/tools/testbed-setup/ansible/roles/virl/tasks/04-disk-image.yaml @@ -1,21 +1,19 @@ --- -- hosts: virl - remote_user: virl - tasks: - name: Create server image directory file: path=/home/virl/virl-server-image state=directory mode=0755 + become: virl - name: Copy UBUNTU server image copy: src=/home/virl/virl-server-image/packer-csit-ubuntu-16.04.1_2017-10-21_2.0-qemu dest=/home/virl/virl-server-image/packer-csit-ubuntu-16.04.1_2017-10-21_2.0-qemu owner=virl group=virl mode=644 + become: virl - name: Copy CENTOS server image copy: src=/home/virl/virl-server-image/packer-csit-centos-7.3-1611_2017-02-23_1.4-qemu dest=/home/virl/virl-server-image/packer-csit-centos-7.3-1611_2017-02-23_1.4-qemu owner=virl group=virl mode=644 + become: virl - name: Import UBUNTU server image into glance shell: virl_uwm_client image-create --subtype server --version csit-ubuntu-16.04.1_2017-10-21_2.0 --image-on-server /home/virl/virl-server-image/packer-csit-ubuntu-16.04.1_2017-10-21_2.0-qemu + become: virl - name: Import CENTOS server image into glance shell: virl_uwm_client image-create --subtype server --version csit-centos-7.3-1611_2017-02-23_1.4 --image-on-server /home/virl/virl-server-image/packer-csit-centos-7.3-1611_2017-02-23_1.4-qemu -- hosts: virl - remote_user: testuser - sudo: yes - tasks: + become: virl - name: Create common directory file: path=/nfs/common state=directory mode=0755 - name: Create Nested VM directory @@ -26,4 +24,4 @@ file: src: /nfs/common/nested-vm-current.img.disabled dest: /nfs/common/nested-vm/csit-nested-1.6.img - state: link
\ No newline at end of file + state: link diff --git a/resources/tools/testbed-setup/ansible/roles/virl/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/virl/tasks/main.yaml new file mode 100644 index 0000000000..8bca04e163 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/roles/virl/tasks/main.yaml @@ -0,0 +1,78 @@ +--- +- name: Interfaces file + template: + src: "files/interfaces_virl" + dest: "/etc/network/interfaces owner=root group=root mode=644" + tags: interfaces + +- name: Add VIRL user + user: + name: virl + shell: "/bin/bash" + comment: "VIRL user" + password: "$6$mJPlK5FKLar6$xxXPP0LRhC7T1yhHtym18Z3nKZweTtfTxzi1WpvVHJ0U/Em1UWcHqfMhRApFp0rsY9jHRuL6FfeFbKPN..uDK." + tags: users + +- name: Add VIRL user to sudoers + copy: + src: "files/sudoers_virl" + dest: "/etc/sudoers.d/virl owner=root group=root mode=660" + tags: sudoers + +- name: Add post up for additional address + copy: + src: "files/ifup" + dest: "/etc/network/if-up.d/virl owner=root group=root mode=755" + tags: interfaces + +- name: Set VIRL user authorized key + authorized_key: + user: virl + key: "{{ lookup('file', '/home/testuser/.ssh/id_rsa.pub') }}" + tags: users + +- name: Install bridge-utils + apt: + name: "bridge-utils" + state: "present" + tags: apt-install-bridge-utils + +- name: Old interface naming + command: "ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules" + tags: interfaces + +- name: Update init for old interface naming + command: "update-initramfs -u" + tags: interfaces + +- 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" + tags: cron + +- 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" + tags: cron + +- 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" + tags: cron + +- 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 '{}' \\;" + tags: cron diff --git a/resources/tools/testbed-setup/ansible/site.yaml b/resources/tools/testbed-setup/ansible/site.yaml new file mode 100644 index 0000000000..b48ce0fa63 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/site.yaml @@ -0,0 +1,11 @@ +---
+# file: site.yaml
+
+- import_playbook: tg.yaml
+ tags: tg
+
+- import_playbook: sut.yaml
+ tags: sut
+
+- import_playbook: virl.yaml
+ tags: virl
diff --git a/resources/tools/testbed-setup/ansible/sut.yaml b/resources/tools/testbed-setup/ansible/sut.yaml new file mode 100644 index 0000000000..d178a02867 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/sut.yaml @@ -0,0 +1,11 @@ +---
+# file: sut.yaml
+
+- hosts: sut
+ remote_user: testuser
+ become: yes
+ become_user: root
+ roles:
+ - common
+ - sut
+ - tg_sut
diff --git a/resources/tools/testbed-setup/ansible/tg.yaml b/resources/tools/testbed-setup/ansible/tg.yaml new file mode 100644 index 0000000000..a524fddb99 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/tg.yaml @@ -0,0 +1,11 @@ +---
+# file: tg.yaml
+
+- hosts: tg
+ remote_user: testuser
+ become: yes
+ become_user: root
+ roles:
+ - common
+ - tg
+ - tg_sut
diff --git a/resources/tools/testbed-setup/ansible/virl.yaml b/resources/tools/testbed-setup/ansible/virl.yaml new file mode 100644 index 0000000000..61f4bcefb0 --- /dev/null +++ b/resources/tools/testbed-setup/ansible/virl.yaml @@ -0,0 +1,10 @@ +---
+# file: virl.yaml
+
+- hosts: virl
+ remote_user: testuser
+ become: yes
+ become_user: root
+ roles:
+ - common
+ - virl
diff --git a/resources/tools/testbed-setup/ansible_hosts b/resources/tools/testbed-setup/ansible_hosts deleted file mode 100644 index 55b5a209e9..0000000000 --- a/resources/tools/testbed-setup/ansible_hosts +++ /dev/null @@ -1,19 +0,0 @@ -#[tg] -#10.30.51.16 hostname=t1-tg1 isolcpus="1-17,19-35" ansible_python_interpreter=/usr/bin/python2.7 -#10.30.51.20 hostname=t2-tg1 isolcpus="1-17,19-35" ansible_python_interpreter=/usr/bin/python2.7 -#10.30.51.24 hostname=t3-tg1 isolcpus="1-17,19-35" ansible_python_interpreter=/usr/bin/python2.7 - -#[sut] -#10.30.51.17 hostname=t1-sut1 isolcpus="1-17,19-35" ansible_python_interpreter=/usr/bin/python2.7 -#10.30.51.18 hostname=t1-sut2 isolcpus="1-17,19-35" ansible_python_interpreter=/usr/bin/python2.7 -#10.30.51.21 hostname=t2-sut1 isolcpus="1-17,19-35" ansible_python_interpreter=/usr/bin/python2.7 -#10.30.51.22 hostname=t2-sut2 isolcpus="1-17,19-35" ansible_python_interpreter=/usr/bin/python2.7 -#10.30.51.25 hostname=t3-sut1 isolcpus="1-17,19-35" ansible_python_interpreter=/usr/bin/python2.7 -#10.30.51.26 hostname=t3-sut2 isolcpus="1-17,19-35" ansible_python_interpreter=/usr/bin/python2.7 - -#By default, let's not touch the VIRL host. Any (unintended) configuration change on VIRL host -#is a recipe for disaster. -#[virl] -#10.30.51.28 hostname=t4-virl1 virl_l2_start=10.30.52.2 virl_l2_end=10.30.52.253 ansible_python_interpreter=/usr/bin/python2.7 virl_l2_gateway=10.30.52.1 virl_l2_network=10.30.52.0/24 virl_l2_ip=10.30.52.254 virl_public_port=eth0 -#10.30.51.29 hostname=t4-virl2 virl_l2_start=10.30.53.2 virl_l2_end=10.30.53.253 ansible_python_interpreter=/usr/bin/python2.7 virl_l2_gateway=10.30.53.1 virl_l2_network=10.30.53.0/24 virl_l2_ip=10.30.53.254 virl_public_port=eth4 -#10.30.51.30 hostname=t4-virl3 virl_l2_start=10.30.54.2 virl_l2_end=10.30.54.253 ansible_python_interpreter=/usr/bin/python2.7 virl_l2_gateway=10.30.54.1 virl_l2_network=10.30.54.0/24 virl_l2_ip=10.30.54.254 virl_public_port=eth0 diff --git a/resources/tools/testbed-setup/cimc/cimc.py b/resources/tools/testbed-setup/cimc/cimc.py index 2e0fc42a25..2e0fc42a25 100755..100644 --- a/resources/tools/testbed-setup/cimc/cimc.py +++ b/resources/tools/testbed-setup/cimc/cimc.py diff --git a/resources/tools/testbed-setup/cimc/cimclib.py b/resources/tools/testbed-setup/cimc/cimclib.py index f91832e0c9..f91832e0c9 100755..100644 --- a/resources/tools/testbed-setup/cimc/cimclib.py +++ b/resources/tools/testbed-setup/cimc/cimclib.py diff --git a/resources/tools/testbed-setup/playbooks/01-host-setup.yaml b/resources/tools/testbed-setup/playbooks/01-host-setup.yaml deleted file mode 100644 index 90a5ad7899..0000000000 --- a/resources/tools/testbed-setup/playbooks/01-host-setup.yaml +++ /dev/null @@ -1,181 +0,0 @@ ---- -- 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: Install libnuma-dev - apt: name=libnuma-dev state=present - - 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 libmbedcrypto0 - apt: name=libmbedcrypto0 state=present - - name: Install libmbedtls10 - apt: name=libmbedtls10 state=present - - name: Install libmbedx509-0 - apt: name=libmbedx509-0 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
\ No newline at end of file diff --git a/resources/tools/testbed-setup/playbooks/files/apt-sources.list b/resources/tools/testbed-setup/playbooks/files/apt-sources.list deleted file mode 100644 index c8ab48e8c8..0000000000 --- a/resources/tools/testbed-setup/playbooks/files/apt-sources.list +++ /dev/null @@ -1,61 +0,0 @@ -# deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted - -# deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted -# deb http://security.ubuntu.com/ubuntu xenial-security main restricted - -# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to -# newer versions of the distribution. -deb http://us.archive.ubuntu.com/ubuntu/ xenial main restricted -deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main restricted - -## Major bug fix updates produced after the final release of the -## distribution. -deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted -deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates main restricted - -## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu -## team. Also, please note that software in universe WILL NOT receive any -## review or updates from the Ubuntu security team. -deb http://us.archive.ubuntu.com/ubuntu/ xenial universe -deb-src http://us.archive.ubuntu.com/ubuntu/ xenial universe -deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe -deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates universe - -## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu -## team, and may not be under a free licence. Please satisfy yourself as to -## your rights to use the software. Also, please note that software in -## multiverse WILL NOT receive any review or updates from the Ubuntu -## security team. -deb http://us.archive.ubuntu.com/ubuntu/ xenial multiverse -deb-src http://us.archive.ubuntu.com/ubuntu/ xenial multiverse -deb http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse -deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-updates multiverse - -## N.B. software from this repository may not have been tested as -## extensively as that contained in the main release, although it includes -## newer versions of some applications which may provide useful features. -## Also, please note that software in backports WILL NOT receive any review -## or updates from the Ubuntu security team. -deb http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse -deb-src http://us.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse - -deb http://security.ubuntu.com/ubuntu xenial-security main restricted -deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted -deb http://security.ubuntu.com/ubuntu xenial-security universe -deb-src http://security.ubuntu.com/ubuntu xenial-security universe -deb http://security.ubuntu.com/ubuntu xenial-security multiverse -deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse - -## Uncomment the following two lines to add software from Canonical's -## 'partner' repository. -## This software is not part of Ubuntu, but is offered by Canonical and the -## respective vendors as a service to Ubuntu users. -# deb http://archive.canonical.com/ubuntu xenial partner -# deb-src http://archive.canonical.com/ubuntu xenial partner - -## Uncomment the following two lines to add software from Ubuntu's -## 'extras' repository. -## This software is not part of Ubuntu, but is offered by third-party -## developers who want to ship their latest software. -# deb http://extras.ubuntu.com/ubuntu xenial main -# deb-src http://extras.ubuntu.com/ubuntu xenial main diff --git a/resources/tools/testbed-setup/playbooks/files/hostname b/resources/tools/testbed-setup/playbooks/files/hostname deleted file mode 100644 index 56baac7265..0000000000 --- a/resources/tools/testbed-setup/playbooks/files/hostname +++ /dev/null @@ -1 +0,0 @@ -{{ hostname }} diff --git a/resources/tools/testbed-setup/playbooks/files/hosts b/resources/tools/testbed-setup/playbooks/files/hosts deleted file mode 100644 index 82dee7b4f7..0000000000 --- a/resources/tools/testbed-setup/playbooks/files/hosts +++ /dev/null @@ -1,7 +0,0 @@ -127.0.0.1 localhost -{{ ansible_default_ipv4["address"] }} {{ hostname }}.linuxfoundation.org {{ hostname }} - -# The following lines are desirable for IPv6 capable hosts -::1 localhost ip6-localhost ip6-loopback -ff02::1 ip6-allnodes -ff02::2 ip6-allrouters diff --git a/resources/tools/testbed-setup/playbooks/files/requirements.txt b/resources/tools/testbed-setup/playbooks/files/requirements.txt deleted file mode 120000 index f96397df02..0000000000 --- a/resources/tools/testbed-setup/playbooks/files/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -../../../../../requirements.txt
\ No newline at end of file diff --git a/resources/tools/testbed-setup/playbooks/files/sudoers b/resources/tools/testbed-setup/playbooks/files/sudoers deleted file mode 100644 index 367c390130..0000000000 --- a/resources/tools/testbed-setup/playbooks/files/sudoers +++ /dev/null @@ -1 +0,0 @@ -testuser ALL=(root) NOPASSWD:ALL diff --git a/resources/tools/testbed-setup/playbooks/reboot.yaml b/resources/tools/testbed-setup/playbooks/reboot.yaml deleted file mode 100644 index 9e22dcbb58..0000000000 --- a/resources/tools/testbed-setup/playbooks/reboot.yaml +++ /dev/null @@ -1,14 +0,0 @@ -- hosts: all - remote_user: testuser - tasks: - - name: Reboot host - sudo: true - command: shutdown -r now "Ansible updates triggered" - async: 0 - poll: 0 - ignore_errors: true - - name: waiting for server to come back - local_action: wait_for host={{ inventory_hostname }} - state=started - sudo: false - diff --git a/resources/tools/testbed-setup/boot-screens_txt.cfg b/resources/tools/testbed-setup/pxe/boot-screens_txt.cfg index 4c73de3855..4c73de3855 100644 --- a/resources/tools/testbed-setup/boot-screens_txt.cfg +++ b/resources/tools/testbed-setup/pxe/boot-screens_txt.cfg diff --git a/resources/tools/testbed-setup/dhcpd.conf b/resources/tools/testbed-setup/pxe/dhcpd.conf index 25e6815962..25e6815962 100644 --- a/resources/tools/testbed-setup/dhcpd.conf +++ b/resources/tools/testbed-setup/pxe/dhcpd.conf diff --git a/resources/tools/testbed-setup/ks.cfg b/resources/tools/testbed-setup/pxe/ks.cfg index a027b950ab..a027b950ab 100644 --- a/resources/tools/testbed-setup/ks.cfg +++ b/resources/tools/testbed-setup/pxe/ks.cfg diff --git a/resources/tools/testbed-setup/syslinux.cfg b/resources/tools/testbed-setup/pxe/syslinux.cfg index 4038c1e9d2..4038c1e9d2 100644 --- a/resources/tools/testbed-setup/syslinux.cfg +++ b/resources/tools/testbed-setup/pxe/syslinux.cfg |