X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Ftools%2Fvagrant%2Fansible%2Froles%2Fcsit%2Ftasks%2Fmain.yml;h=6f226fd54d6824975dd6928b972ede0573ace0e7;hb=04df3394c9b69c22fcbdb993566e548cec58a492;hp=d684d8ea12354e438cb7ccc32b5465ae664245fe;hpb=77afc12214bcb20d3e93cea290c088603af7822e;p=csit.git diff --git a/resources/tools/vagrant/ansible/roles/csit/tasks/main.yml b/resources/tools/vagrant/ansible/roles/csit/tasks/main.yml index d684d8ea12..6f226fd54d 100644 --- a/resources/tools/vagrant/ansible/roles/csit/tasks/main.yml +++ b/resources/tools/vagrant/ansible/roles/csit/tasks/main.yml @@ -1,58 +1,77 @@ --- # file: csit/tasks/main.yml -- name: Upload config to rename network interfaces - copy: - src: 'files/99-vppdevice.yaml' - dest: '/etc/netplan/99-vppdevice.yaml' - owner: 'root' - group: 'root' - mode: 0644 +# 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' -- name: Apply network config changes - command: '/usr/sbin/netplan apply' +# 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: Install required system tools and packages +- 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: - - 'curl' - - 'libpcap-dev' - - 'python3-all' - - 'python3-apt' - - 'python3-cffi' - - 'python3-cffi-backend' - - 'python3-dev' - - 'python3-pip' - - 'python3-setuptools' - - 'virtualenv' - - 'wget' - state: 'present' - cache_valid_time: 3600 + - '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' + update_cache: 'yes' - name: Adjust number of hugepages sysctl: name: 'vm.nr_hugepages' - value: 512 + value: '512' state: 'present' sysctl_file: '/etc/sysctl.d/90-csit.conf' reload: 'yes' -- name: Add an Apt signing key, for docker-ce repository - apt_key: - url: 'https://download.docker.com/linux/ubuntu/gpg' - state: 'present' - -- name: Add docker-ce apt repository if not present - apt_repository: - repo: 'deb https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable' - state: 'present' - -- name: Install docker-ce if it's not already installed - apt: - name: 'docker-ce' - state: 'present' - cache_valid_time: 3600 - - name: "Add user for running tests: {{ csit.test_user.name }}" user: name: '{{ csit.test_user.name }}' @@ -64,13 +83,14 @@ lineinfile: path: '/etc/sudoers.d/{{ csit.test_user.name }}' line: '{{ csit.test_user.name }} ALL=(ALL) NOPASSWD:ALL' - create: yes + create: 'yes' + mode: 660 - name: Add vagrant user to docker group user: name: 'vagrant' groups: - - docker + - 'docker' - name: Reload groups for current session command: '/usr/bin/newgrp docker' @@ -86,6 +106,7 @@ lineinfile: path: '/etc/modules' line: '{{ item }}' + create: 'yes' state: 'present' insertafter: EOF with_items: @@ -99,13 +120,6 @@ accept_hostkey: yes version: '{{ csit.repository.version }}' -- name: Install and update pip and virtualenv - become_user: vagrant - pip: - name: - - 'virtualenv' - state: 'latest' - - name: Prepare python virtual environmant for CSIT become_user: vagrant command: '/usr/bin/virtualenv --python=/usr/bin/python3 {{ csit.home }}/env'