Move neutron-dynamic-routing BGP tests from stadium
This is step 1 of the movement of the tempest plugin for
neutron-dynamic-routing.
Co-Authored-By: Slawek Kaplonski <skaplons@redhat.com>
Change-Id: I35984bb3ad3673b7a54982657c1ac6fdc3ed6de0
diff --git a/roles/docker-setup/files/52_docker_for_tempest b/roles/docker-setup/files/52_docker_for_tempest
new file mode 100644
index 0000000..a61c897
--- /dev/null
+++ b/roles/docker-setup/files/52_docker_for_tempest
@@ -0,0 +1 @@
+tempest ALL=(ALL) NOPASSWD: ALL
diff --git a/roles/docker-setup/files/docker_apparmor b/roles/docker-setup/files/docker_apparmor
new file mode 100644
index 0000000..198eeb7
--- /dev/null
+++ b/roles/docker-setup/files/docker_apparmor
@@ -0,0 +1,34 @@
+#include <tunables/global>
+
+profile docker-default flags=(attach_disconnected,mediate_deleted) {
+
+ #include <abstractions/base>
+
+ network,
+ capability,
+ file,
+ umount,
+
+ deny @{PROC}/* w, # deny write for all files directly in /proc (not in a subdir)
+ # deny write to files not in /proc/<number>/** or /proc/sys/**
+ deny @{PROC}/{[^1-9],[^1-9][^0-9],[^1-9s][^0-9y][^0-9s],[^1-9][^0-9][^0-9][^0-9]*}/** w,
+ deny @{PROC}/sys/[^k]** w, # deny /proc/sys except /proc/sys/k* (effectively /proc/sys/kernel)
+ deny @{PROC}/sys/kernel/{?,??,[^s][^h][^m]**} w, # deny everything except shm* in /proc/sys/kernel/
+ deny @{PROC}/sysrq-trigger rwklx,
+ deny @{PROC}/mem rwklx,
+ deny @{PROC}/kmem rwklx,
+ deny @{PROC}/kcore rwklx,
+
+ deny mount,
+
+ deny /sys/[^f]*/** wklx,
+ deny /sys/f[^s]*/** wklx,
+ deny /sys/fs/[^c]*/** wklx,
+ deny /sys/fs/c[^g]*/** wklx,
+ deny /sys/fs/cg[^r]*/** wklx,
+ deny /sys/firmware/efi/efivars/** rwklx,
+ deny /sys/kernel/security/** rwklx,
+
+ # suppress ptrace denials when using 'docker ps' or using 'ps' inside a container
+ ptrace (trace,read) peer=docker-default,
+}
diff --git a/roles/docker-setup/tasks/main.yml b/roles/docker-setup/tasks/main.yml
new file mode 100644
index 0000000..19d8bfb
--- /dev/null
+++ b/roles/docker-setup/tasks/main.yml
@@ -0,0 +1,36 @@
+- name: Install and configure docker
+ become: yes
+ package:
+ name: docker.io
+ state: present
+
+- name: Copy 52_docker_for_tempest to /etc/sudoers.d
+ copy:
+ src: 52_docker_for_tempest
+ dest: /etc/sudoers.d
+ owner: root
+ group: root
+ mode: 0440
+ become: yes
+
+- name: Copy docker_apparmor to /etc/apparmor.d
+ copy:
+ src: docker_apparmor
+ dest: /etc/apparmor.d
+ owner: root
+ group: root
+ mode: 0640
+ become: yes
+
+- name: Ensure apparmor is restarted
+ become: yes
+ service:
+ name: apparmor
+ state: restarted
+ ignore_errors: yes
+
+- name: Ensure docker engine is restarted
+ become: yes
+ service:
+ name: docker
+ state: restarted