Boilerplate for building vps using terraform and ansible.
- Terraform
- Ansible
- OpenStack
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"
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.
terraform init
terraform plan
terraform apply
ssh username@ipaddress -i path_to_private_key
terraform destory
- gist.github.com - san-tak/tf-bookmark.md
- blog.mosuke.tech
- www.redhat.com - HASHICORP TERRAFORM AND RED HAT ANSIBLE AUTOMATION
- note.com - AnsibleとTerraformと
- conoha.jp - ConoHa API Documentation
- registry.terraform.io - openstack_compute_keypair_v2
- registry.terraform.io - openstack_compute_instance_v2
- qiita.com - TerraformでConoHaのインスタンスを立ててみる
- qiita.com - TerraformからAnsibleのplaybookを実行する
- blog.adachin.me - [OpenStack]TerraformでConoHa VPSのインスタンスを立ち上げてみた!
- github.com - maki0922/terraform_in_conoha
- github.com - hobbby-kube
- github.com - r0b2g1t/terraform-openstack-ansible
- github.com - dan4ex/Terraform
This project is licensed under the terms of the MIT license.