58 lines
1.8 KiB
YAML
58 lines
1.8 KiB
YAML
# 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
|