File tree 13 files changed +380
-1
lines changed
13 files changed +380
-1
lines changed Original file line number Diff line number Diff line change
1
+ [all]
2
+ sc2-snp-test ansible_host =4.246.173.77 ansible_user =sc2
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ # Currently the provisioned VM image for CoCo on Azure VMs uses Ubuntu 20.04
4
+ # so we need to add an APT repository to install python3.10
5
+ # - name: "Add deadsnakes APT repository"
6
+ # become: yes
7
+ # apt_repository:
8
+ # repo: "ppa:deadsnakes/ppa"
9
+
10
+ - name : " Install APT depdencencies"
11
+ become : yes
12
+ apt :
13
+ name :
14
+ - apt-transport-https
15
+ - ca-certificates
16
+ - curl
17
+ - gnupg2
18
+ - software-properties-common
19
+ - python3.10-dev
20
+ - python3-pip
21
+ - python3.10-venv
22
+ - unzip
23
+ update_cache : yes
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ - name : " Create code dir"
4
+ file :
5
+ path : " /home/{{ ansible_user }}/git"
6
+ state : directory
7
+
8
+ - name : " Clone repos"
9
+ git :
10
+ repo : " https://www.github.com/sc2-sys/{{ item }}.git"
11
+ dest : " /home/{{ ansible_user }}/git/sc2-sys/{{ item }}"
12
+ depth : 1
13
+ update : yes
14
+ recursive : no
15
+ clone : yes
16
+ force : yes
17
+ accept_hostkey : yes
18
+ with_items :
19
+ - " applications"
20
+ - " deploy"
21
+ - " experiments"
22
+
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ - name : " Add Docker GPG key"
4
+ become : yes
5
+ apt_key : url=https://download.docker.com/linux/ubuntu/gpg
6
+
7
+ - name : " Add Docker APT repository"
8
+ become : yes
9
+ apt_repository :
10
+ repo : " deb [arch=amd64] https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable"
11
+
12
+ - name : " Install Docker"
13
+ become : yes
14
+ apt :
15
+ name :
16
+ - docker-ce
17
+ - docker-ce-cli
18
+ - containerd.io
19
+ - docker-compose-plugin
20
+ update_cache : yes
21
+
22
+ - name : " Add user to docker group"
23
+ become : yes
24
+ user :
25
+ name : " {{ ansible_user }}"
26
+ groups : docker
27
+ append : yes
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ - name : " Extract version numbers from versions.py"
4
+ shell : |
5
+ grep -oP '{{ item.regex }}' "/home/{{ ansible_user }}/git/sc2-sys/deploy/tasks/util/versions.py"
6
+ register : versions
7
+ loop :
8
+ - { name: "containerd", regex: 'CONTAINERD_VERSION\s*=\s*"\K[^"]+' }
9
+ - { name: "kata-containers", regex: 'KATA_VERSION\s*=\s*"\K[^"]+' }
10
+ - { name: "nydus", regex: 'NYDUS_VERSION\s*=\s*"\K[^"]+' }
11
+ - { name: "nydus-snapshotter", regex: 'NYDUS_SNAPSHOTTER_VERSION\s*=\s*"\K[^"]+' }
12
+
13
+ - name : " Pull Docker images with extracted versions"
14
+ shell : " docker pull ghcr.io/sc2-sys/{{ item.item.name }}:{{ item.stdout }}"
15
+ loop : " {{ versions.results }}"
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ - name : " Install Rust using rustup"
4
+ shell : curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
5
+ args :
6
+ creates : ~/.cargo/bin/rustc
7
+
8
+ - name : " Add Cargo bin directory to PATH"
9
+ lineinfile :
10
+ path : ~/.bashrc
11
+ line : ' export PATH="$HOME/.cargo/bin:$PATH"'
12
+ create : yes
13
+
14
+ - name : " Reload shell profile"
15
+ shell : source ~/.bashrc
16
+ args :
17
+ executable : /bin/bash
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ - name : " Download the kernel with Azure's patches"
4
+ get_url :
5
+ url : " https://github.com/jepio/AMDSEV/releases/download/v2024.02.24/linux-image-6.8.0-rc5-next-20240221-snp-host-2cfe07293708_6.8.0-rc5-g2cfe07293708-2_amd64.deb"
6
+ dest : " /tmp/linux-image.deb"
7
+ mode : ' 0644'
8
+
9
+ # Step 2: Install the .deb kernel package
10
+ - name : " Install the new kernel package"
11
+ apt :
12
+ deb : " /tmp/linux-image.deb"
13
+ state : present
14
+
15
+ # Step 3: Update the grub configuration to use the new kernel
16
+ - name : " Update GRUB to use the new kernel"
17
+ command : update-grub
18
+
19
+ # Step 4: Reboot the system to load the new kernel
20
+ - name : " Reboot the system to apply the new kernel"
21
+ reboot :
22
+ reboot_timeout : 600
23
+ test_command : uname -r
24
+ register : reboot_result
25
+
26
+ # Step 5: Verify the kernel version after reboot
27
+ # TODO: delete me
28
+ - name : Check the new kernel version after reboot
29
+ debug :
30
+ msg : " Using host kernel: {{ reboot_result.stdout }}"
31
+ when : reboot_result is succeeded
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ - hosts : all
4
+ gather_facts : yes
5
+ tasks :
6
+ - include_tasks : tasks/apt.yaml
7
+ - include_tasks : tasks/rust.yaml
8
+ - include_tasks : tasks/docker.yaml
9
+ - include_tasks : tasks/code.yaml
10
+ - include_tasks : tasks/pull_images.yaml
11
+ - include_tasks : tasks/update_host_kernel.yaml
12
+ # - include_tasks: tasks/sc2.yml
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ THIS_DIR=$(dirname $(readlink -f $0))
6
6
PROJ_ROOT=${THIS_DIR} /..
7
7
VENV_PATH=" ${PROJ_ROOT} /venv"
8
8
9
+ PYTHON=python3.10
9
10
PIP=${VENV_PATH} /bin/pip3
10
11
11
12
function pip_cmd {
@@ -15,7 +16,7 @@ function pip_cmd {
15
16
pushd ${PROJ_ROOT} >> /dev/null
16
17
17
18
if [ ! -d ${VENV_PATH} ]; then
18
- python3 -m venv ${VENV_PATH}
19
+ ${PYTHON} -m venv ${VENV_PATH}
19
20
fi
20
21
21
22
pip_cmd install -U pip setuptools wheel
Original file line number Diff line number Diff line change 1
1
ansible >= 8.4.0
2
+ azure-cli >= 2.68.0
2
3
black >= 23.9.1
3
4
flake8 >= 7.1.1
4
5
invoke >= 2.1.0
Original file line number Diff line number Diff line change 1
1
from invoke import Collection
2
2
3
+ from . import azure
3
4
from . import base
4
5
from . import coco
5
6
from . import containerd
27
28
from tasks .coconut import ns as coconut_ns
28
29
29
30
ns = Collection (
31
+ azure ,
30
32
base ,
31
33
coco ,
32
34
containerd ,
You can’t perform that action at this time.
0 commit comments