Revert "fix(IPsecUtil): Delete keywords no longer used"
[csit.git] / fdio.infra.ansible / roles / aws / tasks / main.yaml
1 ---
2 # file: tasks/main.yaml
3
4 - name: Edit repositories
5   include_tasks: "{{ ansible_distribution|lower }}_{{ ansible_distribution_release }}.yaml"
6   tags:
7     - aws-edit-repo
8
9 - name: Prerequisites
10   ansible.builtin.package:
11     name: "{{ packages | flatten(levels=1) }}"
12     state: "latest"
13   tags:
14     - aws-inst-prerequisites
15
16 - name: Switch Kernel At Boot
17   ansible.builtin.lineinfile:
18     path: "/etc/default/grub"
19     state: "present"
20     line: "GRUB_DEFAULT=\"1>2\""
21   notify:
22     - "Update GRUB"
23   tags:
24     - perf-conf-grub
25
26 - meta: flush_handlers
27
28 - name: Load Kernel Modules By Default
29   ansible.builtin.lineinfile:
30     path: "/etc/modules"
31     state: "present"
32     line: "{{ item }}"
33   with_items:
34     - "igb_uio"
35     - "vfio-pci"
36   tags:
37     - aws-load-kernel-modules
38
39 - name: Add Kernel Modules Options (igb_uio)
40   ansible.builtin.lineinfile:
41     path: "/etc/modprobe.d/igb_uio.conf"
42     state: "present"
43     line: "{{ item }}"
44     create: "yes"
45   with_items:
46     - "options igb_uio wc_activate=1"
47   tags:
48     - aws-load-kernel-modules
49
50 - name: Add Kernel Modules Options (vfio-pci)
51   ansible.builtin.lineinfile:
52     path: "/etc/modprobe.d/vfio-noiommu.conf"
53     state: "present"
54     line: "{{ item }}"
55     create: "yes"
56   with_items:
57     - "options vfio enable_unsafe_noiommu_mode=1"
58   tags:
59     - aws-load-kernel-modules
60
61 #- name: Get vfio-pci With WC Patcher
62 #  ansible.builtin.get_url:
63 #    url: "https://github.com/amzn/amzn-drivers/raw/master/userspace/dpdk/enav2-vfio-patch/get-vfio-with-wc.sh"
64 #    dest: "/opt/get-vfio-with-wc.sh"
65 #    mode: 0744
66 #  tags:
67 #    - aws-vfio-patch
68
69 - name: Create vfio-pci Patch Directory
70   ansible.builtin.file:
71     path: "/opt/patches/"
72     state: "directory"
73   tags:
74     - aws-vfio-patch
75
76 - name: Get vfio-pci WC Patch
77   ansible.builtin.get_url:
78     url: "https://github.com/amzn/amzn-drivers/raw/master/userspace/dpdk/enav2-vfio-patch/patches/{{ item }}"
79     dest: "/opt/patches/{{ item }}"
80     mode: 0744
81   with_items:
82     - "linux-4.10-vfio-wc.patch"
83     - "linux-5.8-vfio-wc.patch"
84     - "linux-5.15-vfio-wc.patch"
85   tags:
86     - aws-vfio-patch
87
88 - name: Copy vfio-pci WC Patch
89   ansible.builtin.copy:
90     src: "files/get-vfio-with-wc.sh"
91     dest: "/opt"
92     mode: 0744
93   tags:
94     - aws-vfio-patch
95
96 - name: Compile vfio-pci With WC Patch
97   ansible.builtin.shell: "/bin/bash /opt/get-vfio-with-wc.sh"
98   environment:
99     DEBIAN_FRONTEND: "noninteractive"
100     TERM: "vt100"
101   tags:
102     - aws-vfio-patch
103
104 - name: Reload systemd-modules
105   ansible.builtin.systemd:
106     name: "systemd-modules-load"
107     state: "restarted"
108   tags:
109     - aws-reload-systemd-modules
110
111 - name: Adjust nr_hugepages
112   ansible.builtin.sysctl:
113     name: "vm.nr_hugepages"
114     value: "8192"
115     state: "present"
116     sysctl_file: "/etc/sysctl.d/90-csit.conf"
117     reload: true
118   tags:
119     - aws-set-hugepages
120
121 - name: Shutdown host with delay
122   ansible.builtin.command: "/sbin/shutdown -P +720"
123   tags:
124     - aws-set-self-terminate