aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/testbed-setup/ansible/roles/kernel_vm
diff options
context:
space:
mode:
authorvagrant <pmikus@cisco.com>2020-02-04 14:16:01 +0000
committerPeter Mikus <pmikus@cisco.com>2020-02-07 20:08:43 +0000
commit8605f3f406468f57bb9b2eac12a4421f65965300 (patch)
tree5eef32ff0298ab1c3ac593adced4a502d7c8ea17 /resources/tools/testbed-setup/ansible/roles/kernel_vm
parentd7e14a0a93e7e06047daeaf6a5575f227aeb925a (diff)
CSIT Azure integration
+ Terraform + Ansible Signed-off-by: Peter Mikus <pmikus@cisco.com> Change-Id: I353511c5ef39d8c8d43fedc61c8dbb30b4821e1b
Diffstat (limited to 'resources/tools/testbed-setup/ansible/roles/kernel_vm')
-rw-r--r--resources/tools/testbed-setup/ansible/roles/kernel_vm/files/initramfs_modules4
-rw-r--r--resources/tools/testbed-setup/ansible/roles/kernel_vm/files/initramfs_resume1
-rw-r--r--resources/tools/testbed-setup/ansible/roles/kernel_vm/tasks/main.yaml92
3 files changed, 97 insertions, 0 deletions
diff --git a/resources/tools/testbed-setup/ansible/roles/kernel_vm/files/initramfs_modules b/resources/tools/testbed-setup/ansible/roles/kernel_vm/files/initramfs_modules
new file mode 100644
index 0000000000..00ae8e03e7
--- /dev/null
+++ b/resources/tools/testbed-setup/ansible/roles/kernel_vm/files/initramfs_modules
@@ -0,0 +1,4 @@
+9p
+9pnet
+9pnet_virtio
+vfio-pci \ No newline at end of file
diff --git a/resources/tools/testbed-setup/ansible/roles/kernel_vm/files/initramfs_resume b/resources/tools/testbed-setup/ansible/roles/kernel_vm/files/initramfs_resume
new file mode 100644
index 0000000000..820819823b
--- /dev/null
+++ b/resources/tools/testbed-setup/ansible/roles/kernel_vm/files/initramfs_resume
@@ -0,0 +1 @@
+RESUME=none \ No newline at end of file
diff --git a/resources/tools/testbed-setup/ansible/roles/kernel_vm/tasks/main.yaml b/resources/tools/testbed-setup/ansible/roles/kernel_vm/tasks/main.yaml
new file mode 100644
index 0000000000..ba9426a55f
--- /dev/null
+++ b/resources/tools/testbed-setup/ansible/roles/kernel_vm/tasks/main.yaml
@@ -0,0 +1,92 @@
+---
+# file: roles/kernel_vm/tasks/main.yaml
+
+- name: Kernel VM - Backup remote initramfs modules
+ copy:
+ src: "/etc/initramfs-tools/modules"
+ dest: "/tmp/initramfs_modules.bkp"
+ remote_src: yes
+ ignore_errors: yes
+ register: __initramfs_modules_backuped
+ tags:
+ - install-kernel-image
+
+- name: Kernel VM - Backup remote initramfs resume config
+ copy:
+ src: "/etc/initramfs-tools/conf.d/resume"
+ dest: "/tmp/initramfs-resume.bkp"
+ remote_src: yes
+ ignore_errors: yes
+ register: __initramfs_resume_backuped
+ tags:
+ - install-kernel-image
+
+- name: Kernel VM - Update remote initramfs modules
+ copy:
+ src: "../files/initramfs_modules"
+ dest: "/etc/initramfs-tools/modules"
+ tags:
+ - install-kernel-image
+
+- name: Kernel VM - Update remote initramfs resume config
+ copy:
+ src: "../files/initramfs_resume"
+ dest: "/etc/initramfs-tools/conf.d/resume"
+ tags:
+ - install-kernel-image
+
+- name: Kernel VM - Create target kernel dir
+ file:
+ path: "/opt/boot"
+ state: "directory"
+ tags:
+ - install-kernel-image
+
+- name: Kernel VM - Build initrd image
+ shell: "update-initramfs -k {{ ansible_kernel }} -c -b /opt/boot"
+ tags:
+ - install-kernel-image
+
+- name: Kernel VM - Copy corresponding kernel img
+ copy:
+ src: "/boot/vmlinuz-{{ ansible_kernel }}"
+ dest: "/opt/boot/vmlinuz-{{ ansible_kernel }}"
+ remote_src: yes
+ tags:
+ - install-kernel-image
+
+- name: Kernel VM - Restore remote initramfs modules
+ copy:
+ src: "/tmp/initramfs_modules.bkp"
+ dest: "/etc/initramfs-tools/modules"
+ remote_src: yes
+ ignore_errors: yes
+ when: __initramfs_modules_backuped
+ tags:
+ - install-kernel-image
+
+- name: Kernel VM - Remove remote backup initramfs modules
+ file:
+ path: "/tmp/initramfs_modules.bkp"
+ state: "absent"
+ when: __initramfs_modules_backuped
+ tags:
+ - install-kernel-image
+
+- name: Kernel VM - Restore remote initramfs resume config
+ copy:
+ src: "/tmp/initramfs-resume.bkp"
+ dest: "/etc/initramfs-tools/conf.d/resume"
+ remote_src: yes
+ ignore_errors: yes
+ when: __initramfs_resume_backuped
+ tags:
+ - install-kernel-image
+
+- name: Kernel VM - Remove remote backup initramfs resume config
+ file:
+ path: "/tmp/initramfs-resume.bkp"
+ state: "absent"
+ when: __initramfs_resume_backuped
+ tags:
+ - install-kernel-image