From 2552ada8124f7d2762040a6a182b72b2774507de Mon Sep 17 00:00:00 2001 From: Roberto Alsina Date: Wed, 26 Jun 2024 17:38:28 -0300 Subject: [PATCH] Firecracker, do not use, it sucks --- provision-pinky/firecracker.yml | 57 +++++++++++++++++++++++++++++++++ provision-pinky/hosts | 3 +- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 provision-pinky/firecracker.yml diff --git a/provision-pinky/firecracker.yml b/provision-pinky/firecracker.yml new file mode 100644 index 0000000..e971671 --- /dev/null +++ b/provision-pinky/firecracker.yml @@ -0,0 +1,57 @@ +# Setup Firecracker for VMs +- name: Firecracker + hosts: servers + become_method: ansible.builtin.sudo + become: true + tasks: + - name: Get firecracker + become: false + ansible.builtin.get_url: + url: https://github.com/firecracker-microvm/firecracker/releases/download/v1.7.0/firecracker-v1.7.0-aarch64.tgz + dest: ~ralsina/firecracker.tgz + mode: '0644' + - name: Get kernel + become: false + ansible.builtin.get_url: + url: https://s3.amazonaws.com/spec.ccfc.min/img/quickstart_guide/aarch64/kernels/vmlinux.bin + dest: ~ralsina/vmlinux.bin + mode: '0644' + - name: Get root image + become: false + ansible.builtin.get_url: + url: https://s3.amazonaws.com/spec.ccfc.min/img/quickstart_guide/aarch64/rootfs/bionic.rootfs.ext4 + dest: ~ralsina/bionic.rootfs.ext4 + mode: '0644' + - name: Unpack firecracker + become: false + ansible.builtin.unarchive: + src: ~ralsina/firecracker.tgz + dest: ~ralsina + remote_src: true + - name: Install firecracker + become: true + ansible.builtin.command: + cmd: mv /home/ralsina/release-v1.7.0-aarch64/firecracker-v1.7.0-aarch64 /usr/bin/firecracker + creates: /usr/bin/firecracker + - name: Setup systemd unit for firecracker + become: true + ansible.builtin.copy: + dest: /etc/systemd/system/firecracker.service + content: | + [Unit] + Description=Firecracker VM Manager + + [Service] + Type=simple + ExecStart=/usr/bin/firecracker --api-sock /tmp/firecracker.socket + Restart=always + + [Install] + WantedBy=default.target + mode: '0644' + - name: Start and enable service + become: true + ansible.builtin.service: + name: firecracker + state: started + enabled: true diff --git a/provision-pinky/hosts b/provision-pinky/hosts index 9e03793..53fb850 100644 --- a/provision-pinky/hosts +++ b/provision-pinky/hosts @@ -3,4 +3,5 @@ pinky ansible_user=ralsina rocky ansible_user=ralsina [servers:vars] -ansible_connection=ssh \ No newline at end of file +ansible_connection=ssh +ansible_python_interpreter=/usr/bin/python3 \ No newline at end of file