From: pmikus Date: Thu, 6 Oct 2016 07:39:28 +0000 (+0100) Subject: Update ansible playbooks with documentation X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=commitdiff_plain;h=a7568a2eabf0872d25260c14ec084cb3d5ffb0f3 Update ansible playbooks with documentation - Update ansible playbooks scripts for Ubuntu 16.04.1 with latest requirement for setting of physical hosts including VIRL - Update readme file Change-Id: I94e7ab62f729ea2eefb2a6640d0c53f3abc54bac Signed-off-by: pmikus --- diff --git a/resources/tools/testbed-setup/README.md b/resources/tools/testbed-setup/README.md index a83fe1496f..e795a2e4fc 100644 --- a/resources/tools/testbed-setup/README.md +++ b/resources/tools/testbed-setup/README.md @@ -28,12 +28,16 @@ is available on the PXE bootstrap server in ~testuser/host-setup. - `sudo apt-get install isc-dhcp-server tftpd-hpa nginx-light ansible` - `cd ~testuser/host-setup` - - `wget 'http://releases.ubuntu.com/14.04/ubuntu-14.04.4-server-amd64.iso'` + - `wget 'http://releases.ubuntu.com/16.04.1/ubuntu-16.04.1-server-amd64.iso'` - `sudo mkdir /mnt/cdrom` - - `sudo mount -o loop ubuntu-14.04.4-server-amd64.iso /mnt/cdrom/` + - `sudo mount -o loop ubuntu-16.04.1-server-amd64.iso /mnt/cdrom/` - `sudo cp -r /mnt/cdrom/install/netboot/* /var/lib/tftpboot/` - `sudo mkdir /usr/share/nginx/html/ubuntu` - `sudo cp -r /mnt/cdrom/* /usr/share/nginx/html/ubuntu/` + - `sudo cp /mnt/cdrom/ubuntu/isolinux/ldlinux.c32 /var/lib/tftpboot` + - `sudo cp /mnt/cdrom/ubuntu/isolinux/libcom32.c32 /var/lib/tftpboot` + - `sudo cp /mnt/cdrom/ubuntu/isolinux/libutil.c32 /var/lib/tftpboot` + - `sudo cp /mnt/cdrom/ubuntu/isolinux/chain.c32 /var/lib/tftpboot` - `sudo umount /mnt/cdrom` - edit ks.cfg and replace IP address with that of your PXE bootstrap server - `sudo cp ks.cfg /usr/share/nginx/html/ks.cfg` @@ -51,9 +55,12 @@ is available on the PXE bootstrap server in ~testuser/host-setup. From PXE boostrap server: - `cd ~testuser/host-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 - `./cimc.py -u admin -p Cisco1234 $CIMC_ADDRESS -d -s '' -s '' -s ''` - - add MAC address to DHCP + - add MAC address to DHCP (/etc/dhcp/dhcpd.conf) + - Reboot server with boot from PXE (restart immediately) - `./cimc.py -u admin -p Cisco1234 $CIMC_ADDRESS -d -pxe` While Ubuntu install is running: @@ -63,6 +70,7 @@ While Ubuntu install is running: - `./cimc.py -u admin -p Cisco1234 $CIMC_ADDRESS -d -r -rl 1 -rs -rd '[1,2]'` Alternatively, create the RAID array manually. + - Set the next boot from HDD (without restart) - `./cimc.py -u admin -p Cisco1234 $CIMC_ADDRESS -d -hdd` When installation is finished: @@ -74,11 +82,11 @@ When installation is finished: Example for physical testbed hosts: ~~~ [tg] - 10.30.51.16 hostname=t1-tg1 + 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 - 10.30.51.18 hostname=t1-sut2 + 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 ~~~ Example for VIRL hosts -- use the "virl" tag and specify the flat network start and end addresses: diff --git a/resources/tools/testbed-setup/dhcpd.conf b/resources/tools/testbed-setup/dhcpd.conf new file mode 100644 index 0000000000..25e6815962 --- /dev/null +++ b/resources/tools/testbed-setup/dhcpd.conf @@ -0,0 +1,90 @@ +# +# Sample configuration file for ISC dhcpd for Debian +# +# Attention: If /etc/ltsp/dhcpd.conf exists, that will be used as +# configuration file instead of this file. +# +# + +# The ddns-updates-style parameter controls whether or not the server will +# attempt to do a DNS update when a lease is confirmed. We default to the +# behavior of the version 2 packages ('none', since DHCP v2 didn't +# have support for DDNS.) +ddns-update-style none; + +# option definitions common to all supported networks... +option domain-name "linuxfoundation.org"; +option domain-name-servers 199.204.44.24, 199.204.47.54; + +default-lease-time 600; +max-lease-time 7200; + +# If this DHCP server is the official DHCP server for the local +# network, the authoritative directive should be uncommented. +authoritative; + +# Use this to send dhcp log messages to a different log file (you also +# have to hack syslog.conf to complete the redirection). +log-facility local7; + +# This is content of file (/etc/dhcp/dhcpd.conf) currently located on host +# t4-virl1 with address 10.30.51.28. Please reflect any actual changes before +# overwriting. This file is used for PXE boot. +subnet 10.30.51.0 netmask 255.255.255.0 { + option routers 10.30.51.1; + host t1-tg1 { + hardware ethernet 00:fe:c8:e5:6c:76; + fixed-address 10.30.51.16; + filename "pxelinux.0"; + } + host t1-sut1 { + hardware ethernet 00:fe:c8:e5:68:32; + fixed-address 10.30.51.17; + filename "pxelinux.0"; + } + host t1-sut2 { + hardware ethernet cc:46:d6:17:e0:58; + fixed-address 10.30.51.18; + filename "pxelinux.0"; + } + host t2-tg1 { + hardware ethernet 00:fe:c8:e5:6a:72; + fixed-address 10.30.51.20; + filename "pxelinux.0"; + } + host t2-sut1 { + hardware ethernet 00:fe:c8:e5:68:e0; + fixed-address 10.30.51.21; + filename "pxelinux.0"; + } + host t2-sut2 { + hardware ethernet 00:fe:c8:58:1e:f6; + fixed-address 10.30.51.22; + filename "pxelinux.0"; + } + host t3-tg1 { + hardware ethernet 00:fe:c8:e5:68:c2; + fixed-address 10.30.51.24; + filename "pxelinux.0"; + } + host t3-sut1 { + hardware ethernet 00:f2:8b:7c:fb:4a; + fixed-address 10.30.51.25; + filename "pxelinux.0"; + } + host t3-sut2 { + hardware ethernet 58:ac:78:5c:90:78; + fixed-address 10.30.51.26; + filename "pxelinux.0"; + } + host t4-virl2 { + hardware ethernet 00:42:68:6f:68:ee; + fixed-address 10.30.51.29; + filename "pxelinux.0"; + } + host t4-virl3 { + hardware ethernet 00:42:68:6f:6f:c0; + fixed-address 10.30.51.30; + filename "pxelinux.0"; + } +} diff --git a/resources/tools/testbed-setup/ks.cfg b/resources/tools/testbed-setup/ks.cfg index 6759b1f6e5..e98509be4c 100644 --- a/resources/tools/testbed-setup/ks.cfg +++ b/resources/tools/testbed-setup/ks.cfg @@ -79,3 +79,4 @@ preseed user-setup/allow-password-weak boolean true %packages openssh-server +python2.7 diff --git a/resources/tools/testbed-setup/playbooks/01-host-setup.yaml b/resources/tools/testbed-setup/playbooks/01-host-setup.yaml index b4907c6d45..7158ce2428 100644 --- a/resources/tools/testbed-setup/playbooks/01-host-setup.yaml +++ b/resources/tools/testbed-setup/playbooks/01-host-setup.yaml @@ -3,6 +3,8 @@ remote_user: testuser sudo: yes tasks: + - name: install python-apt + raw: apt-get update && apt-get install python-apt -y -q - name: copy sudoers file copy: src=files/sudoers dest=/etc/sudoers.d/testuser owner=root group=root mode=660 - name: copy hosts file @@ -11,10 +13,6 @@ template: src=files/hostname dest=/etc/hostname owner=root group=root mode=644 - name: interfaces file template: src=files/interfaces dest=/etc/network/interfaces owner=root group=root mode=644 - - name: copy ttyS0 file - template: src=files/ttyS0 dest=/etc/init/ttyS0.conf owner=root group=root mode=644 - - name: start ttyS0 - service: name=ttyS0 state=started - name: copy grub file template: src=files/grub dest=/etc/default/grub owner=root group=root mode=644 - name: update grub @@ -29,6 +27,8 @@ apt: name=crudini state=present - name: install expect apt: name=expect state=present + - name: install qemu + apt: name=qemu-system-x86 state=present - hosts: virl remote_user: testuser sudo: yes @@ -39,16 +39,22 @@ copy: src=files/sudoers_virl dest=/etc/sudoers.d/virl owner=root group=root mode=660 - name: Set VIRL user authorized key authorized_key: user=virl key="{{ lookup('file', '/home/testuser/.ssh/id_rsa.pub') }}" - - name: install qemu (as a workaround) - apt: name=qemu-system-x86 state=present - hosts: tg:sut remote_user: testuser sudo: yes tasks: + - 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 cpufrequtils apt: name=cpufrequtils state=present - name: Set cpufrequtils defaults @@ -71,22 +77,12 @@ tasks: - name: Install unzip apt: name=unzip state=present - - name: pstate parameter - lineinfile: dest=/etc/default/grub regexp=^GRUB_CMDLINE_LINUX= line=GRUB_CMDLINE_LINUX="\"intel_pstate=disable\"" - - name: update grub - command: update-grub - hosts: sut remote_user: testuser sudo: yes tasks: - - name: copy sysctl file - template: src=files/90-csit dest=/etc/sysctl.d/90-csit.conf owner=root group=root mode=644 - name: Install dkms apt: name=dkms state=present - - name: isolcpus and pstate parameter - lineinfile: dest=/etc/default/grub regexp=^GRUB_CMDLINE_LINUX= line=GRUB_CMDLINE_LINUX="\"isolcpus={{ isolcpus }} nohz_full={{ nohz }} rcu_nocbs={{ rcu }} intel_pstate=disable\"" - - name: update grub - command: update-grub - name: Install pkg-config apt: name=pkg-config state=present - name: Install libglib2.0-dev @@ -95,3 +91,5 @@ apt: name=autoconf state=present - name: Install libtool apt: name=libtool state=present + - name: Disable 80-vpp.conf + command: ln -s /dev/null /etc/sysctl.d/80-vpp.conf