- Updated all AMIs that are not currently in use. |
4 years ago | |
|---|---|---|
| modules | 4 years ago | |
| .gitignore | 4 years ago | |
| .terraform.lock.hcl | 4 years ago | |
| README.md | 4 years ago | |
| cloud_init.cfg | 4 years ago | |
| example.tfvars | 4 years ago | |
| get-aws-node-status.sh | 4 years ago | |
| get-libvirt-bridge-ips.sh | 4 years ago | |
| get-vm-ips.sh | 4 years ago | |
| main.tf | 4 years ago | |
| providers.tf | 4 years ago | |
| variables.tf | 4 years ago | |
README.md
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
-
From within the nodes-terraform directory run
terraform init. You will a see bunch if output as terraform grabs the dependencies it needs. -
Copy the shared
terraform.tfvarsfrom S3.aws s3 cp s3://mss-terraform-state/global/s3/terraform.tfvars .For instructions on getting AWS CLI to work correctly see
aws-api-setup.mdin thedoc-opsrepo.Take care to copy your
terraform.tfvarsback to the S3 bucket whenever you make a change to it. -
Verify that you branch and variables match whats deployed by running
terraform plan. If everything is in sync you should seeNo 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.
python3 -c 'import crypt; print(crypt.crypt("test", crypt.mksalt(crypt.METHOD_SHA512)))'