Skip to content

bmf-san/terraform-ansible-openstack-boilerplate

Repository files navigation

terraform-ansible-openstack-boilerplate

Boilerplate for building vps using terraform and ansible.

Features

  • Terraform
  • Ansible
  • OpenStack

Get started

Generate a ssh key

Before you start, generate a key for root and a key for the execution user.

ex. ssh-keygen -t rsa -b 4096 -C "example@example.com"

Setup tfvars

Copy example.tfvars with any name you like, and edit it like this.

ex.

user_name="user1234"
password="password1234"
tenant_name="tenant1234"
auth_url="https://identity.tyo2.conoha.io/v2.0"
image_name="vmi-ubuntu-20.04-amd64-30gb"
flavor_name="g-1gb"
keypair_name="keypair1234"
path_to_public_key_for_root="~/.ssh/publickey.pub"
path_to_private_key_for_root="~/.ssh/privatekey"
instance_name="instance1234"
instance_name_tag="instancetag1234"
host="web"
new_user_name="admin"
new_user_password="password1234"
shell="/bin/bash"
path_to_public_key="~/.ssh/publickey.pub"
port="22"

If you give tfvars file a name other than terraform.tfvars, you need to use option when executing a command. terraform COMMAND -var-file anyname.tfvars

If you name it terraform.tfvars, you do not need to specify -var-file option.

Init

terraform init

Plan

terraform plan

Apply

terraform apply

Check ssh connection

ssh username@ipaddress -i path_to_private_key

Destroy

terraform destory

Reference

License

This project is licensed under the terms of the MIT license.

About

Boilerplate for building vps using terraform and ansible.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages