Pulumi start | libvirt-python 00 | bootstrap
description⌗
Following my previous post about qemu/kvm setup, this is about pulumi/libvirt provider.
tasks⌗
- install pulumi
- bootstrap project
- test
1. install pulumi⌗
curl -fsSL https://get.pulumi.com | sh
source ~/.bashrc
pulumi version
# personal aliases
echo 'alias pp="pulumi up -y"' >> ~/.bashrc
echo 'alias pd="pulumi destroy -y"' >> ~/.bashrc
source ~/.bashrc
2. bootstrap project⌗
1. state, local⌗
PROJECT_NAME=kvm-deb-02
PULUMI_ROOT=~/PULUMI
PULUMI_STATE=${PULUMI_ROOT}/state/state-${PROJECT_NAME}
rm -rf ${PULUMI_ROOT}/${PROJECT_NAME} ${PULUMI_STATE}
mkdir -p ${PULUMI_ROOT}/${PROJECT_NAME}
cd ${PULUMI_ROOT}/${PROJECT_NAME}
mkdir ${PULUMI_STATE}
pulumi login file://${PULUMI_STATE}
2. start project⌗
pulumi new python \
--description "Creates a Ubuntu 20.04 VM via libvirt" \
--name ${PROJECT_NAME} \
--stack dev
source venv/bin/activate
export PULUMI_CONFIG_PASSPHRASE=1
pip install pulumi_libvirt
KVM_HOST=kvm-deb-02
ssh-copy-id root@${KVM_HOST}
pulumi config set libvirt:uri qemu+ssh://root@${KVM_HOST}/system
vi __main__.py
"""A Python Pulumi program"""
import pulumi_libvirt as libvirt
domain = libvirt.Domain("ubuntu")
This will create a dummy
virtual machine, main purpose is to confirm that communication is working fine.
3. test⌗
in my hypervisor
, run:
watch virsh list --all
and in my workstation
, run:
pulumi up
then check output of both terminals, then destroy it
pulumi destroy
Read other posts