You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
2.2 KiB
Markdown
64 lines
2.2 KiB
Markdown
A terraform script that will setup VMs via AWS or KVM/QEMU (libvirt).
|
|
|
|
The modules allow you create N VMs of a specific type. So you could create 1
|
|
master node and 3 worker nodes or you could create 3 Ubuntu VMs and 5 CentOS
|
|
VMs, or whatever fits your needs.
|
|
|
|
This script creates the VMs and then uses Cloud-init for initial configuration
|
|
of the VMs.
|
|
|
|
libvirt vs. AWS
|
|
----------------------------------------
|
|
|
|
This script allows VMs to be created libvirt or AWS. You can choose either one,
|
|
however, running both at the same time has not been tested. Therefore, when
|
|
using one, you should comment out all code pertaining to the other provider.
|
|
|
|
Cloud-Init
|
|
----------------------------------------
|
|
|
|
Both the libvirt and aws modules use cloud-init for initial configuration of the
|
|
VMs. Cloud-init is used to create the admin user and add the mss-admin keys.
|
|
Cloud-init is also used to install some initial packages. The goal is to get
|
|
these VMs setup enough so that they can be configured via Ansible.
|
|
|
|
Environment Setup
|
|
----------------------------------------
|
|
|
|
1. From within the nodes-terraform directory run `terraform init`. You will a
|
|
see bunch if output as terraform grabs the dependencies it needs.
|
|
|
|
2. Copy the shared `terraform.tfvars` from S3.
|
|
```shell
|
|
aws s3 cp s3://mss-terraform-state/global/s3/terraform.tfvars .
|
|
```
|
|
For instructions on getting AWS CLI to work correctly see `aws-api-setup.md`
|
|
in the `doc-ops` repo.
|
|
|
|
Take care to copy your `terraform.tfvars` back to the S3 bucket whenever you
|
|
make a change to it.
|
|
|
|
3. Verify that you branch and variables match whats deployed by running
|
|
`terraform plan`. If everything is in sync you should see `No changes. Your
|
|
infrastructure matches the configuration.` _IF_ you do not see this message
|
|
make sure to sync with the other admins before continuing.
|
|
|
|
|
|
Dependencies
|
|
----------------------------------------
|
|
|
|
_UNFINISHED_
|
|
TODO REM add libvirt provider
|
|
libvirt provider depends on mkisofs
|
|
|
|
security_driver = none for ubuntu host, link github issue.
|
|
https://github.com/dmacvicar/terraform-provider-libvirt/issues/546
|
|
|
|
Other
|
|
----------------------------------------
|
|
|
|
Create a password hash.
|
|
```shell
|
|
python3 -c 'import crypt; print(crypt.crypt("test", crypt.mksalt(crypt.METHOD_SHA512)))'
|
|
```
|