Skip to content

Commit

Permalink
Enhance libvirt module docs to cover libvirt installation and fix mac…
Browse files Browse the repository at this point in the history
… plugin setup
  • Loading branch information
rgielen committed May 30, 2021
1 parent 93b99bf commit dd86886
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions provider/libvirt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@ This module integrates the libvirt provider with hobby-kube.
## Prerequisites

First of all, a working KVM / QEMU host with bridged networking is needed.
The module works both when provisioned from the virtualization host as well as on a machine with `qemu+ssh`-access to a host machine.
The module works both when provisioned from the virtualization host as well as on a machine with proper `qemu+ssh`-access to a host machine.
Some installations have to be made **on the machine that is used for Terraform provisioning**:

* libvirt
* terraform-provider-libvirt
* mkisofs

### Linux

[Libvirt](https://libvirt.org/) needs to be installed to communicate with the Linux virtualization host, if the provisioning machine is not the host as well.
On Ubuntu this can be done with
```
sudo apt-get install libvirt-clients
```

[Download a suitable terraform-provider-libvirt release](https://github.com/dmacvicar/terraform-provider-libvirt/releases) and extract the binary.
Once the binary is extracted, it can be placed in the user's Terraform plugins cache:

Expand All @@ -34,15 +41,21 @@ sudo apt install genisoimage

### MacOS

[Libvirt](https://libvirt.org/) needs to be installed to communicate with the Linux virtualization host.
This can be done with Homebrew:
```
brew install libvirt
```

There is no pre-compiled binary for terraform-provider-libvirt for MacOS.
Instead, it can be [built from source](https://github.com/dmacvicar/terraform-provider-libvirt#building-from-source).

Similar to Linux, the resulting binary needs to be placed in the user's terraform plugin cache directory:
Similar to Linux, the resulting binary needs to be placed in the [user's terraform plugin cache directory](https://www.terraform.io/docs/commands/cli-config.html#provider-installation):

```
export TERRAFORM_LIBVIRT_VERSION="0.6.2"
mkdir -p ~/.local/share/terraform/plugins/registry.terraform.io/dmacvicar/libvirt/$TERRAFORM_LIBVIRT_VERSION/darwin_amd64
cp terraform-provider-libvirt ~/.local/share/terraform/plugins/registry.terraform.io/dmacvicar/libvirt/$TERRAFORM_LIBVIRT_VERSION/darwin_amd64
mkdir -p ~/Library/Application\ Support/io.terraform/plugins/registry.terraform.io/dmacvicar/libvirt/$TERRAFORM_LIBVIRT_VERSION/darwin_amd64
cp terraform-provider-libvirt ~/Library/Application\ Support/io.terraform/plugins/registry.terraform.io/dmacvicar/libvirt/$TERRAFORM_LIBVIRT_VERSION/darwin_amd64
```

`mkisofs` is also needed.
Expand All @@ -57,7 +70,7 @@ brew install cdrtools
Uncomment the libvirt-provider module in the top-level `main.tf` file.
Configure your desired setup in `terraform.tfvars`.

See provided `terraform.tfvars.example` for possible options and explanations.
See the provided `terraform.tfvars.example` file in the module directory for possible options and explanations.

### Network Setup

Expand Down

0 comments on commit dd86886

Please sign in to comment.