Install virtual machines using Terraform and libvirt
domain
: Domain name for the virtual machine (Default:example.com
)master_count
: Number of master nodes to create (Default:1
)worker_count
: Number of worker nodes to create (Default:3
)installation_image
: Image used to install the nodes (Default:https://dl.rockylinux.org/pub/rocky/9/images/x86_64/Rocky-9-GenericCloud.latest.x86_64.qcow2
)user
: Dictionary with user information for the default user which is created on all nodesname
: User name (Default:Username from user who executes the playbook
)gecos
: Gecos information (Default:Gecos from user who executes the playbook
)group
: Group name (Default:same as name
)ssh_pub_key
: Public key for the user (Default:$HOME/.ssh/id_rsa.pub from user who executes the playbook
)
tf_binary_path
: Path to the terraform binary (Default:False
)debug_terraform
: Enable or disable debugging the role (Default:false
)
- Terraform: https://www.terraform.io/downloads.html
- Libvirt provider for Terraform: https://github.com/dmacvicar/terraform-provider-libvirt#installing
The Ansible module terraform is used to install the virtual infrastructure together with the libvirt provider for Terraform. The Terraform state is saved in the directory mosibi-kubernetes/roles/infrastructure/terraform/tf-data.
If you need to remove the virtual infrastructure created with this Ansible role, change to the Terraform state directory (mosibi-kubernetes/roles/infrastructure/terraform/tf-data) and execute the following command, with the right values for the variables. The installation_image
variable must be set, but is not used during removal, so the /dev/null value is okay.
terraform destroy \
-auto-approve \
-var 'domain=example.com' \
-var 'installation_image=/dev/null' \
-var 'worker_count=4' \
-var 'master_count=1'