From c6103c8482d1acbc0d1c3bc71ad0de8903b73a3c Mon Sep 17 00:00:00 2001 From: pmikus Date: Fri, 9 Apr 2021 07:04:27 +0000 Subject: Infra: Vagrant upgrade to focal + Upgradfe to focal + Move to better place + Integrate with ansible library Signed-off-by: pmikus Change-Id: Ibddea33efa2c3587251f9f03921282fb47ffee31 --- csit.infra.vagrant/Vagrantfile | 85 ++++++++++++ docs/testing_in_vagrant.rst | 12 +- .../vagrant_inventory/group_vars/vagrant.yml | 5 + .../inventories/vagrant_inventory/hosts | 4 + fdio.infra.ansible/roles/vagrant/defaults/main.yml | 14 ++ .../roles/vagrant/files/99-vppdevice.yaml | 28 ++++ fdio.infra.ansible/roles/vagrant/tasks/main.yml | 42 ++++++ fdio.infra.ansible/site.yaml | 4 + fdio.infra.ansible/vagrant.yaml | 24 ++++ resources/tools/vagrant/Vagrantfile | 107 ---------------- .../tools/vagrant/ansible/group_vars/vppdevice.yml | 14 -- resources/tools/vagrant/ansible/master.yml | 3 - .../vagrant/ansible/roles/common/tasks/main.yml | 8 -- .../vagrant/ansible/roles/csit/defaults/main.yml | 38 ------ .../ansible/roles/csit/files/99-vppdevice.yaml | 28 ---- .../vagrant/ansible/roles/csit/tasks/main.yml | 142 --------------------- resources/tools/vagrant/ansible/vppdevice | 4 - resources/tools/vagrant/ansible/vppdevice.yml | 6 - 18 files changed, 212 insertions(+), 356 deletions(-) create mode 100644 csit.infra.vagrant/Vagrantfile create mode 100644 fdio.infra.ansible/inventories/vagrant_inventory/group_vars/vagrant.yml create mode 100644 fdio.infra.ansible/inventories/vagrant_inventory/hosts create mode 100644 fdio.infra.ansible/roles/vagrant/defaults/main.yml create mode 100644 fdio.infra.ansible/roles/vagrant/files/99-vppdevice.yaml create mode 100644 fdio.infra.ansible/roles/vagrant/tasks/main.yml create mode 100644 fdio.infra.ansible/vagrant.yaml delete mode 100644 resources/tools/vagrant/Vagrantfile delete mode 100644 resources/tools/vagrant/ansible/group_vars/vppdevice.yml delete mode 100644 resources/tools/vagrant/ansible/master.yml delete mode 100644 resources/tools/vagrant/ansible/roles/common/tasks/main.yml delete mode 100644 resources/tools/vagrant/ansible/roles/csit/defaults/main.yml delete mode 100644 resources/tools/vagrant/ansible/roles/csit/files/99-vppdevice.yaml delete mode 100644 resources/tools/vagrant/ansible/roles/csit/tasks/main.yml delete mode 100644 resources/tools/vagrant/ansible/vppdevice delete mode 100644 resources/tools/vagrant/ansible/vppdevice.yml diff --git a/csit.infra.vagrant/Vagrantfile b/csit.infra.vagrant/Vagrantfile new file mode 100644 index 0000000000..4088ece555 --- /dev/null +++ b/csit.infra.vagrant/Vagrantfile @@ -0,0 +1,85 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + + # Configure cached packages to be shared between instances of the + # same base box. + if Vagrant.has_plugin?("vagrant-cachier") + config.cache.scope = :box + end + + # Configure proxy if needed. + if Vagrant.has_plugin?("vagrant-proxyconf") + config.proxy.http = "http://192.168.0.2:3128/" + config.proxy.https = "http://192.168.0.2:3128/" + config.proxy.ftp = "http://192.168.0.2:3128/" + config.proxy.no_proxy = "localhost,127.0.0.1" + end + + # Configure testing network interfaces (tg). + config.vm.network :private_network, type: "dhcp", auto_config: false, virtualbox__intnet: "link1", nic_type: "82545em", mac: "0800270fe04d" + config.vm.network :private_network, type: "dhcp", auto_config: false, virtualbox__intnet: "link2", nic_type: "82545em", mac: "08002761f7ad" + config.vm.network :private_network, type: "dhcp", auto_config: false, virtualbox__intnet: "link3", nic_type: "82545em", mac: "080027dc5da4" + + # Configure testing network interfaces (sut). + config.vm.network :private_network, type: "dhcp", auto_config: false, virtualbox__intnet: "link1", nic_type: "82545em", mac: "080027385e58" + config.vm.network :private_network, type: "dhcp", auto_config: false, virtualbox__intnet: "link2", nic_type: "82545em", mac: "080027e3f542" + config.vm.network :private_network, type: "dhcp", auto_config: false, virtualbox__intnet: "link3", nic_type: "82545em", mac: "0800274f7c63" + + # Provision the box using ansible local (no Ansible installation needed + # on host). + config.vm.provision "ansible_local" do |ansible| + ansible.version = "latest" + ansible.compatibility_mode = "2.0" + ansible.become = true + ansible.verbose = false + ansible.limit = "vagrant" + ansible.inventory_path = "../fdio.infra.ansible/inventories/vagrant/hosts" + ansible.playbook = "../fdio.infra.ansible/site.yml" + end + + config.vm.post_up_message = <<-MESSAGE + Your virtual machine is configured! + + Login to the box using command: + vagrant ssh + + To run some tests use the VPP Device bootstrap script, eg: + cd /home/vagrant/csit/resources/libraries/bash/entry + ./bootstrap_vpp_device.sh csit-vpp-device-master-ubuntu2004-1n-vbox + + To run only selected tests based on TAGS, export environment variables + before running the test suite: + export GERRIT_EVENT_TYPE="comment-added" + export GERRIT_EVENT_COMMENT_TEXT="devicetest memif" + ./bootstrap_vpp_device.sh csit-vpp-device-master-ubuntu2004-1n-vbox + + For more information please visit: + https://docs.fd.io/csit/master/report/ + https://docs.fd.io/csit/master/trending/ + + MESSAGE + + config.vm.define "focal", primary: true do |bionic| + # Base box definition, currently using + # Official Ubuntu 20.04 LTS (Focal) Daily Build + bionic.vm.box = "ubuntu/focal64" + bionic.vm.box_version = "v20210407.0.0" + bionic.vm.box_check_update = false + + # Virtualbox machine configuration + bionic.vm.provider "virtualbox" do |vb| + vb.name = "vppdevice-focal" + vb.gui = false + vb.memory = "8192" + vb.cpus = "4" + vb.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"] + vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"] + vb.customize ["modifyvm", :id, "--nicpromisc4", "allow-all"] + vb.customize ["modifyvm", :id, "--nicpromisc5", "allow-all"] + vb.customize ["modifyvm", :id, "--nicpromisc6", "allow-all"] + vb.customize ["modifyvm", :id, "--nicpromisc7", "allow-all"] + end + end +end diff --git a/docs/testing_in_vagrant.rst b/docs/testing_in_vagrant.rst index d3a0041539..b509e3d452 100644 --- a/docs/testing_in_vagrant.rst +++ b/docs/testing_in_vagrant.rst @@ -6,7 +6,7 @@ Install prerequisites Run all commands from command line. -1. Download and install latest virtualbox from `official page +1. Download and install virtualbox from `official page `_. To verify the installation, run VBoxManage: @@ -18,7 +18,7 @@ Run all commands from command line. VBoxManage --version - You should see virtualbox manager version printed, eg: 6.1.12r139181 + Tested version: 6.1.16r140961 2. Download and install latest vagrant `from official page `_. @@ -26,7 +26,7 @@ Run all commands from command line. vagrant -v - You should see vagrant version printed, eg: Vagrant 2.2.9 + Tested version: Vagrant 2.2.15 3. Install vagrant plugins:: @@ -44,7 +44,7 @@ Set up and run Vagrant virtualbox Before running following commands change working directory to Vagrant specific directory (from within root CSIT directory) :: - cd resources/libraries/tools/vagrant + cd csit.infra.vagrant This allows Vagrant to automatically find Vagrantfile and corresponding Vagrant environment. @@ -74,7 +74,7 @@ Run tests From within the box run the tests using:: cd /home/vagrant/csit/resources/libraries/bash/entry - ./bootstrap_vpp_device.sh csit-vpp-device-master-ubuntu1804-1n-vbox + ./bootstrap_vpp_device.sh csit-vpp-device-master-ubuntu2004-1n-vbox To run only selected tests based on TAGS, export environment variables before running the test suite:: @@ -83,6 +83,6 @@ running the test suite:: export GERRIT_EVENT_COMMENT_TEXT="devicetest memif" # now it will run tests, selected based on tags - ./bootstrap_vpp_device.sh csit-vpp-device-master-ubuntu1804-1n-vbox + ./bootstrap_vpp_device.sh csit-vpp-device-master-ubuntu2004-1n-vbox diff --git a/fdio.infra.ansible/inventories/vagrant_inventory/group_vars/vagrant.yml b/fdio.infra.ansible/inventories/vagrant_inventory/group_vars/vagrant.yml new file mode 100644 index 0000000000..20cea1d3d4 --- /dev/null +++ b/fdio.infra.ansible/inventories/vagrant_inventory/group_vars/vagrant.yml @@ -0,0 +1,5 @@ +--- +# file: vagrant_inventory/group_vars/all.yaml + +# Ansible interpreter (for PIP) +ansible_python_interpreter: "/usr/bin/python3" \ No newline at end of file diff --git a/fdio.infra.ansible/inventories/vagrant_inventory/hosts b/fdio.infra.ansible/inventories/vagrant_inventory/hosts new file mode 100644 index 0000000000..451a01621c --- /dev/null +++ b/fdio.infra.ansible/inventories/vagrant_inventory/hosts @@ -0,0 +1,4 @@ +# Inventory file for VPP Device vagrant environment + +[vagrant] +localhost ansible_connection=local diff --git a/fdio.infra.ansible/roles/vagrant/defaults/main.yml b/fdio.infra.ansible/roles/vagrant/defaults/main.yml new file mode 100644 index 0000000000..caa3339bb0 --- /dev/null +++ b/fdio.infra.ansible/roles/vagrant/defaults/main.yml @@ -0,0 +1,14 @@ +--- +# file: vagrant/defaults/main.yml + +# Settings for VPP Device host group +csit: + home: "/home/vagrant/csit" + test_user: + name: "testuser" + password: "$6$/mAr/JDJc0u6/i$sLBptji85Xo/vdAv43bP4NpTaAfSBY8p3G7Uj9p4fKysrvs7XF8.FmlC56j4AzOun6nnf7PA.elytvfWoEHCL1" + home: "/home/testuser" + shell: "/bin/bash" + repository: + url: "https://gerrit.fd.io/r/csit" + version: "HEAD" diff --git a/fdio.infra.ansible/roles/vagrant/files/99-vppdevice.yaml b/fdio.infra.ansible/roles/vagrant/files/99-vppdevice.yaml new file mode 100644 index 0000000000..bcaa67099d --- /dev/null +++ b/fdio.infra.ansible/roles/vagrant/files/99-vppdevice.yaml @@ -0,0 +1,28 @@ +network: + version: 2 + renderer: networkd + ethernets: + enp0s8: + match: + macaddress: 08:00:27:0f:e0:4d + set-name: enpTGa + enp0s9: + match: + macaddress: 08:00:27:61:f7:ad + set-name: enpTGb + enp0s17: + match: + macaddress: 08:00:27:dc:5d:a4 + set-name: enpTGc + enp0s10: + match: + macaddress: 08:00:27:38:5e:58 + set-name: enpSUTa + enp0s16: + match: + macaddress: 08:00:27:e3:f5:42 + set-name: enpSUTb + enp0s18: + match: + macaddress: 08:00:27:4f:7c:63 + set-name: enpSUTc diff --git a/fdio.infra.ansible/roles/vagrant/tasks/main.yml b/fdio.infra.ansible/roles/vagrant/tasks/main.yml new file mode 100644 index 0000000000..fa4ab4af9a --- /dev/null +++ b/fdio.infra.ansible/roles/vagrant/tasks/main.yml @@ -0,0 +1,42 @@ +--- +# file: vagrant/tasks/main.yml + +# General +- name: Adjust number of hugepages + sysctl: + name: "vm.nr_hugepages" + value: "512" + state: "present" + sysctl_file: "/etc/sysctl.d/90-csit.conf" + reload: yes + +- name: "Add user for running tests: {{ csit.test_user.name }}" + user: + name: "{{ csit.test_user.name }}" + password: "{{ csit.test_user.password }}" + home: "{{ csit.test_user.home }}" + shell: "{{ csit.test_user.shell }}" + +- name: Add vagrant user to docker group + user: + name: "vagrant" + groups: + - "docker" + +- name: Reload groups for current session + command: "/usr/bin/newgrp docker" + +- name: Clone CSIT repository + become_user: vagrant + git: + repo: "{{ csit.repository.url }}" + dest: "{{ csit.home }}" + accept_hostkey: yes + version: "{{ csit.repository.version }}" + +- name: Load csit docker image from local drive if it exists (/vagrant/csit-sut.tar) + shell: | + if [ -z "$(docker images -q `cat {{ csit.home }}/VPP_DEVICE_IMAGE`)" ] && [ -e /vagrant/csit-sut.tar ]; then + docker load -i /vagrant/csit-sut.tar; + fi; + ignore_errors: yes diff --git a/fdio.infra.ansible/site.yaml b/fdio.infra.ansible/site.yaml index 4436c21b18..c2ad98cd48 100644 --- a/fdio.infra.ansible/site.yaml +++ b/fdio.infra.ansible/site.yaml @@ -24,3 +24,7 @@ - import_playbook: dev.yaml tags: - dev + +- import_playbook: vagrant.yaml + tags: + - vagrant \ No newline at end of file diff --git a/fdio.infra.ansible/vagrant.yaml b/fdio.infra.ansible/vagrant.yaml new file mode 100644 index 0000000000..005f7866e3 --- /dev/null +++ b/fdio.infra.ansible/vagrant.yaml @@ -0,0 +1,24 @@ +--- +# file: vagrant.yaml + +- hosts: vagrant + remote_user: vagrant + become: yes + become_user: root + gather_facts: false + pre_tasks: + - name: Gathering Facts + gather_facts: + tags: + - always + roles: + - role: common + tags: common + - role: python_env + tags: python_env + - role: docker + tags: docker + - role: vpp + tags: vpp + - role: vagrant + tags: vagrant \ No newline at end of file diff --git a/resources/tools/vagrant/Vagrantfile b/resources/tools/vagrant/Vagrantfile deleted file mode 100644 index 1c3071931c..0000000000 --- a/resources/tools/vagrant/Vagrantfile +++ /dev/null @@ -1,107 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -Vagrant.configure("2") do |config| - - # Configure cached packages to be shared between instances of the - # same base box. - if Vagrant.has_plugin?("vagrant-cachier") - config.cache.scope = :box - end - - # Configure proxy if needed. - if Vagrant.has_plugin?("vagrant-proxyconf") - config.proxy.http = "http://192.168.0.2:3128/" - config.proxy.https = "http://192.168.0.2:3128/" - config.proxy.ftp = "http://192.168.0.2:3128/" - config.proxy.no_proxy = "localhost,127.0.0.1" - end - - # Configure testing network interfaces (tg). - config.vm.network :private_network, type: "dhcp", auto_config: false, virtualbox__intnet: "link1", nic_type: "82545em", mac: "0800270fe04d" - config.vm.network :private_network, type: "dhcp", auto_config: false, virtualbox__intnet: "link2", nic_type: "82545em", mac: "08002761f7ad" - config.vm.network :private_network, type: "dhcp", auto_config: false, virtualbox__intnet: "link3", nic_type: "82545em", mac: "080027dc5da4" - - # Configure testing network interfaces (sut). - config.vm.network :private_network, type: "dhcp", auto_config: false, virtualbox__intnet: "link1", nic_type: "82545em", mac: "080027385e58" - config.vm.network :private_network, type: "dhcp", auto_config: false, virtualbox__intnet: "link2", nic_type: "82545em", mac: "080027e3f542" - config.vm.network :private_network, type: "dhcp", auto_config: false, virtualbox__intnet: "link3", nic_type: "82545em", mac: "0800274f7c63" - - # Provision the box using ansible local (no Ansible installation needed - # on host). - config.vm.provision "ansible_local" do |ansible| - ansible.version = "latest" - ansible.compatibility_mode = "2.0" - ansible.become = true - ansible.verbose = false - ansible.limit = "all" - ansible.inventory_path = "ansible/vppdevice" - ansible.playbook = "ansible/master.yml" - end - - config.vm.post_up_message = <<-MESSAGE - Your virtual machine is configured! - - Login to the box using command: - vagrant ssh - - To run some tests use the VPP Device bootstrap script, eg: - cd /home/vagrant/csit/resources/libraries/bash/entry - ./bootstrap_vpp_device.sh csit-vpp-device-master-ubuntu1804-1n-vbox - - To run only selected tests based on TAGS, export environment variables - before running the test suite: - export GERRIT_EVENT_TYPE="comment-added" - export GERRIT_EVENT_COMMENT_TEXT="devicetest memif" - ./bootstrap_vpp_device.sh csit-vpp-device-master-ubuntu1804-1n-vbox - - For more information please visit: - https://docs.fd.io/csit/rls1908/report/index.html - https://docs.fd.io/csit/master/trending/ - - MESSAGE - - config.vm.define "bionic", primary: true do |bionic| - # Base box definition, currently using - # Official Ubuntu 18.04 LTS (Bionic Beaver) Daily Build - bionic.vm.box = "ubuntu/bionic64" - bionic.vm.box_version = "20190724.1.0" - bionic.vm.box_check_update = false - - # Virtualbox machine configuration - bionic.vm.provider "virtualbox" do |vb| - vb.name = "vppdevice-bionic" - vb.gui = false - vb.memory = "8192" - vb.cpus = "4" - vb.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"] - vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"] - vb.customize ["modifyvm", :id, "--nicpromisc4", "allow-all"] - vb.customize ["modifyvm", :id, "--nicpromisc5", "allow-all"] - vb.customize ["modifyvm", :id, "--nicpromisc6", "allow-all"] - vb.customize ["modifyvm", :id, "--nicpromisc7", "allow-all"] - end - end - - config.vm.define "centos8", autostart: false do |centos8| - # Base box definition, currently using - # Official CentOS8 v1905.1 - centos8.vm.box = "centos/8" - centos8.vm.box_version = "1905.1" - centos8.vm.box_check_update = false - - # Virtualbox machine configuration - centos8.vm.provider "virtualbox" do |vb| - vb.name = "vppdevice-centos8" - vb.gui = false - vb.memory = "8192" - vb.cpus = "4" - vb.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"] - vb.customize ["modifyvm", :id, "--nicpromisc3", "allow-all"] - vb.customize ["modifyvm", :id, "--nicpromisc4", "allow-all"] - vb.customize ["modifyvm", :id, "--nicpromisc5", "allow-all"] - vb.customize ["modifyvm", :id, "--nicpromisc6", "allow-all"] - vb.customize ["modifyvm", :id, "--nicpromisc7", "allow-all"] - end - end -end diff --git a/resources/tools/vagrant/ansible/group_vars/vppdevice.yml b/resources/tools/vagrant/ansible/group_vars/vppdevice.yml deleted file mode 100644 index b920c3be18..0000000000 --- a/resources/tools/vagrant/ansible/group_vars/vppdevice.yml +++ /dev/null @@ -1,14 +0,0 @@ ---- -# Ansible interpreter (for PIP) -ansible_python_interpreter: 'python3' -# Settings for VPP Device host group -csit: - home: '/home/vagrant/csit' - test_user: - name: 'testuser' - password: '$6$/mAr/JDJc0u6/i$sLBptji85Xo/vdAv43bP4NpTaAfSBY8p3G7Uj9p4fKysrvs7XF8.FmlC56j4AzOun6nnf7PA.elytvfWoEHCL1' - home: '/home/testuser' - shell: '/bin/bash' - repository: - url: 'https://gerrit.fd.io/r/csit' - version: 'HEAD' diff --git a/resources/tools/vagrant/ansible/master.yml b/resources/tools/vagrant/ansible/master.yml deleted file mode 100644 index ffce5bc6fc..0000000000 --- a/resources/tools/vagrant/ansible/master.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -# file: master.yml -- import_playbook: vppdevice.yml diff --git a/resources/tools/vagrant/ansible/roles/common/tasks/main.yml b/resources/tools/vagrant/ansible/roles/common/tasks/main.yml deleted file mode 100644 index 1d4d273971..0000000000 --- a/resources/tools/vagrant/ansible/roles/common/tasks/main.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -# file: common/tasks/main.yml - -- name: Set /bin/sh to bash instead of dash - alternatives: - name: sh - link: /bin/sh - path: /bin/bash diff --git a/resources/tools/vagrant/ansible/roles/csit/defaults/main.yml b/resources/tools/vagrant/ansible/roles/csit/defaults/main.yml deleted file mode 100644 index 7a8999c4cb..0000000000 --- a/resources/tools/vagrant/ansible/roles/csit/defaults/main.yml +++ /dev/null @@ -1,38 +0,0 @@ ---- -# file: csit/defaults/main.yml - -csit_packages: "{{ csit_packages_base + csit_packages_by_distro[ansible_distribution|lower] }}" - -csit_packages_base: - - 'curl' - - 'python3-cffi' - - 'python3-pip' - - 'python3-setuptools' - - 'virtualenv' - - 'wget' - -csit_packages_by_distro: - centos: - - 'autoconf' - - 'automake' - - 'binutils' - - 'bison' - - 'flex' - - 'gcc' - - 'gcc-c++' - - 'gdb' - - 'git' - - 'glibc-devel' - - 'libpcap-devel' - - 'libtool' - - 'make' - - 'pkgconf' - - 'pkgconf-m4' - - 'pkgconf-pkg-config' - - 'redhat-rpm-config' - - 'rpm-build' - - 'rpm-sign' - - 'strace' - ubuntu: - - 'build-essential' - - 'libpcap-dev' diff --git a/resources/tools/vagrant/ansible/roles/csit/files/99-vppdevice.yaml b/resources/tools/vagrant/ansible/roles/csit/files/99-vppdevice.yaml deleted file mode 100644 index bcaa67099d..0000000000 --- a/resources/tools/vagrant/ansible/roles/csit/files/99-vppdevice.yaml +++ /dev/null @@ -1,28 +0,0 @@ -network: - version: 2 - renderer: networkd - ethernets: - enp0s8: - match: - macaddress: 08:00:27:0f:e0:4d - set-name: enpTGa - enp0s9: - match: - macaddress: 08:00:27:61:f7:ad - set-name: enpTGb - enp0s17: - match: - macaddress: 08:00:27:dc:5d:a4 - set-name: enpTGc - enp0s10: - match: - macaddress: 08:00:27:38:5e:58 - set-name: enpSUTa - enp0s16: - match: - macaddress: 08:00:27:e3:f5:42 - set-name: enpSUTb - enp0s18: - match: - macaddress: 08:00:27:4f:7c:63 - set-name: enpSUTc diff --git a/resources/tools/vagrant/ansible/roles/csit/tasks/main.yml b/resources/tools/vagrant/ansible/roles/csit/tasks/main.yml deleted file mode 100644 index 9c8f575959..0000000000 --- a/resources/tools/vagrant/ansible/roles/csit/tasks/main.yml +++ /dev/null @@ -1,142 +0,0 @@ ---- -# file: csit/tasks/main.yml - -# CentOS 8 specific -- name: CentOS - Install epel repositories - dnf: - name: - - 'epel-release' - when: - - ansible_distribution|lower == 'centos' - -- name: CentOS - Enable PowerTools - command: > - dnf config-manager - --set-enabled PowerTools - when: - - ansible_distribution|lower == 'centos' - -# NOTE: containerd.io >1.2.0-3 requirement disabled by RH -# Unable to install current docker version as of now -# Using docker-ce-3:18.09.1-3.el7 -- name: CentOS - Add docker-ce repo - command: > - dnf config-manager - --add-repo=https://download.docker.com/linux/centos/docker-ce.repo - when: - - ansible_distribution|lower == 'centos' - -- name: CentOS - Install docker-ce - dnf: - name: - - 'docker-ce-3:18.09.1-3.el7' - when: - - ansible_distribution|lower == 'centos' - -# Ubuntu specific -- name: Ubuntu - Add docker-ce GPG key - apt_key: - url: 'https://download.docker.com/linux/ubuntu/gpg' - when: - - ansible_distribution|lower == 'ubuntu' - -- name: Ubuntu - Add docker-ce repo - apt_repository: - repo: 'deb https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable' - filename: 'docker' - mode: 644 - when: - - ansible_distribution|lower == 'ubuntu' - -- name: Ubuntu - Install docker-ce - apt: - name: - - 'docker-ce' - - 'containerd.io' - - 'docker-ce-cli' - when: - - ansible_distribution|lower == 'ubuntu' - -# General -- name: Install required system tools and packages - package: - name: "{{ csit_packages | join(',') }}" - state: 'latest' - -- name: Adjust number of hugepages - sysctl: - name: 'vm.nr_hugepages' - value: '512' - state: 'present' - sysctl_file: '/etc/sysctl.d/90-csit.conf' - reload: 'yes' - -- name: "Add user for running tests: {{ csit.test_user.name }}" - user: - name: '{{ csit.test_user.name }}' - password: '{{ csit.test_user.password }}' - home: '{{ csit.test_user.home }}' - shell: '{{ csit.test_user.shell }}' - -- name: "Allow passwordless sudo for user: {{ csit.test_user.name }}" - lineinfile: - path: '/etc/sudoers.d/{{ csit.test_user.name }}' - line: '{{ csit.test_user.name }} ALL=(ALL) NOPASSWD:ALL' - create: 'yes' - mode: 660 - -- name: Add vagrant user to docker group - user: - name: 'vagrant' - groups: - - 'docker' - -- name: Reload groups for current session - command: '/usr/bin/newgrp docker' - -- name: Load required kernel modules - modprobe: - name: '{{ item }}' - state: 'present' - with_items: - - vfio-pci - -- name: Enable required kernel modules on boot - lineinfile: - path: '/etc/modules' - line: '{{ item }}' - create: 'yes' - state: 'present' - insertafter: EOF - with_items: - - vfio-pci - -- name: Clone CSIT repository - become_user: vagrant - git: - repo: '{{ csit.repository.url }}' - dest: '{{ csit.home }}' - accept_hostkey: yes - version: '{{ csit.repository.version }}' - -- name: Prepare python virtual environmant for CSIT - become_user: vagrant - command: '/usr/bin/virtualenv --python=/usr/bin/python3 {{ csit.home }}/env' - args: - chdir: '{{ csit.home }}' - creates: '{{ csit.home }}/env/bin/activate' - -- name: Install python dependencies (from {{ csit.home }}/requirements.txt) - become_user: vagrant - shell: | - source '{{ csit.home }}/env/bin/activate' && - pip3 install --timeout 300 -r '{{ csit.home }}/requirements.txt' - args: - executable: '/bin/bash' - -- name: Load csit docker image from local drive if it exists (/vagrant/csit-sut.tar) - shell: | - if [ -z "$(docker images -q `cat {{ csit.home }}/VPP_DEVICE_IMAGE`)" ] && [ -e /vagrant/csit-sut.tar ]; then - docker load -i /vagrant/csit-sut.tar; - fi; - ignore_errors: yes diff --git a/resources/tools/vagrant/ansible/vppdevice b/resources/tools/vagrant/ansible/vppdevice deleted file mode 100644 index 3273c644a0..0000000000 --- a/resources/tools/vagrant/ansible/vppdevice +++ /dev/null @@ -1,4 +0,0 @@ -# Inventory file for VPP Device box environment - -[vppdevice] -localhost ansible_connection=local diff --git a/resources/tools/vagrant/ansible/vppdevice.yml b/resources/tools/vagrant/ansible/vppdevice.yml deleted file mode 100644 index 7c3992cf26..0000000000 --- a/resources/tools/vagrant/ansible/vppdevice.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -# file: vppdevice.yml -- hosts: vppdevice - roles: - - common - - csit \ No newline at end of file -- cgit 1.2.3-korg