aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.ansible
diff options
context:
space:
mode:
authorpmikus <pmikus@cisco.com>2021-04-09 07:04:27 +0000
committerPeter Mikus <pmikus@cisco.com>2021-04-21 12:55:28 +0000
commitc6103c8482d1acbc0d1c3bc71ad0de8903b73a3c (patch)
tree134113578b7286894972e1f824f3ee50e38d5f8a /fdio.infra.ansible
parent1e5030b987404fb1cf1dfabe31a150092ff84a3d (diff)
Infra: Vagrant upgrade to focal
+ Upgradfe to focal + Move to better place + Integrate with ansible library Signed-off-by: pmikus <pmikus@cisco.com> Change-Id: Ibddea33efa2c3587251f9f03921282fb47ffee31
Diffstat (limited to 'fdio.infra.ansible')
-rw-r--r--fdio.infra.ansible/inventories/vagrant_inventory/group_vars/vagrant.yml5
-rw-r--r--fdio.infra.ansible/inventories/vagrant_inventory/hosts4
-rw-r--r--fdio.infra.ansible/roles/vagrant/defaults/main.yml14
-rw-r--r--fdio.infra.ansible/roles/vagrant/files/99-vppdevice.yaml28
-rw-r--r--fdio.infra.ansible/roles/vagrant/tasks/main.yml42
-rw-r--r--fdio.infra.ansible/site.yaml4
-rw-r--r--fdio.infra.ansible/vagrant.yaml24
7 files changed, 121 insertions, 0 deletions
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