feat: provision vps on OVH public cloud

This commit is contained in:
Aravinth Manivannan 2024-01-11 05:27:00 +05:30
commit 2d77f8fc2c
Signed by: realaravinth
GPG key ID: F8F50389936984FF
6 changed files with 106 additions and 0 deletions

4
dolibarr/.env.sample Normal file
View file

@ -0,0 +1,4 @@
export OVH_ENDPOINT=ovh-sgp
export OVH_APPLICATION_KEY=Your_key_application_OVH(or_AK)
export OVH_APPLICATION_SECRET=Your_secret_application_key_OVH(or_AS)
export OVH_CONSUMER_KEY=Your_token(or_CK)

6
dolibarr/.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
openrc.sh
.env
dolibar
terraform.tfstate.d/
dolibar
dolibar

View file

@ -0,0 +1,44 @@
# This file is maintained automatically by "tofu init".
# Manual edits may be lost in future updates.
provider "registry.opentofu.org/ovh/ovh" {
version = "0.36.1"
constraints = ">= 0.13.0"
hashes = [
"h1:tnlSvJOjfAdftnDLGJlT4QwAkwfnAacZkfSmlEId1Ww=",
"zh:01636ca3d7514d8cc32984f8ce2279d7083acf4afd32c7e7ca6367a53e7c2485",
"zh:112056366ac269cf897ded8588952bd3d1a143d75ea27239c4c206df21afea16",
"zh:24142c8e5751d308136b98aa837e8eeaa37ea646bee954619699c5858bb77083",
"zh:283d37e51b5bba7bf8ea84d42394f4911cb6d99e6fb705c16d41401ae8f6cd5e",
"zh:54d37f4da815f06926a2ad928a06945bef8087cbc4ba86376f8ffb9ed7faf9b3",
"zh:57f8d1ee26fbe84ac840196e8ae8b30880053e78dc5beaa684ab8dae8331fc43",
"zh:5f453abf80b33b5773121be643fd77fea8e974a42a120d60034080894c8a525b",
"zh:6b5451322de2b78e2158626a4df7f9fbef6188673c9627a2343ca3ba8bafff93",
"zh:7530eb0f87f9ee2d385525a14e868d3076e15629c3aad687d9bd0a892a42c310",
"zh:b97ecccb8587115d21af8a68fb90e801afa114cd7119fce461eac4b95eeb2b1d",
"zh:c1f9bbcebe5b9e07678604c12b1e1f5b51d563dbedf48d7e6b979bafbb2affc5",
"zh:c348e23e60b4b37dcd0de2d34af74741cb3fe1d40385d599526c3c0dd7e3ebde",
"zh:fc9a2aa711af236ef1ea514ee390e719732e09a4ed81405d826430f53a1d9306",
]
}
provider "registry.opentofu.org/terraform-provider-openstack/openstack" {
version = "1.42.0"
constraints = "~> 1.42.0"
hashes = [
"h1:hpQ+kc+S2Nwcqqt0TtBdiLKJpaLxq5z2eKrA+kjoMq4=",
"zh:116e297f03eb304819f8cffd66f25b77638435db2d612c2b1d56205cbbef485f",
"zh:332411f8425caaa9ca799cc60ccbab188c6108fa2765032a5cb22a5df36b5fc5",
"zh:3843cf3c563ae0348bcd41107508399df997a7293b2a3a79e73264be81dc456c",
"zh:4d16af37327d36bb86913220b763ed6e599b47db7702948f019e535c5b9413d4",
"zh:9557b325e4617977f0fec913673d2542556174811415417be7dee20f7ab2fec1",
"zh:95b4754370eda28624f7dfcfdfc4016775bf6433535b60a8f3d99fd651e71afa",
"zh:97c240eba6a179e5910c0afdee97f916ab4537b360db21143ab2dfb0919087e3",
"zh:b231c1c988914f4f0be3115a432f50cf43c410867f8b3aff7e3bf7c31739c940",
"zh:b3b105ee70e440d350d8fecf50d458ad7d4b9b4a3ab580e9b8ff1e3fec9a6b76",
"zh:b531f02dca64486c302046d959770a6b32ac26fc6d1830582e9959d0384dbe20",
"zh:b80a2e60dae300217f44318a74b7e45cfe7009a11b937f06fb07f677863cec59",
"zh:f18e8dada1e2941585893c579d169bc908c68cb7b71406c47cafc0a3bdcddbe8",
"zh:fbdc031f496fa1f80fcab41f1e3cf2e2f99b0266b685079b4a4c4c61720c914c",
]
}

19
dolibarr/dolibar_box.tf Normal file
View file

@ -0,0 +1,19 @@
# Creating an SSH key pair resource
resource "openstack_compute_keypair_v2" "test_keypair" {
provider = openstack.ovh # Provider name declared in provider.tf
name = "test_keypair" # Name of the SSH key to use for creation
public_key = file("~/.ssh/aravinth.pub") # Path to your previously generated SSH key
}
# Creating the instance
resource "openstack_compute_instance_v2" "test_terraform_instance" {
name = "dolibarr.playground.libre-solutions.com" # Instance name
provider = openstack.ovh # Provider name
image_name = "Debian 12" # Image name
flavor_name = "d2-2" # Instance type name
# Name of openstack_compute_keypair_v2 resource named keypair_test
key_pair = openstack_compute_keypair_v2.test_keypair.name
network {
name = "Ext-Net" # Adds the network component to reach your instance
}
}

2
dolibarr/hosts.ini Executable file
View file

@ -0,0 +1,2 @@
[dolibar_hosts]
dolibar ansible_host=geno.sh ansible_user=debian

31
dolibarr/provider.tf Normal file
View file

@ -0,0 +1,31 @@
# Define providers and set versions
terraform {
required_version = ">= 0.14.0" # Takes into account Terraform versions from 0.14.0
required_providers {
openstack = {
source = "terraform-provider-openstack/openstack"
version = "~> 1.42.0"
}
ovh = {
source = "ovh/ovh"
version = ">= 0.13.0"
}
}
}
# Configure the OpenStack provider hosted by OVHcloud
provider "openstack" {
auth_url = "https://auth.cloud.ovh.net/v3/" # Authentication URL
domain_name = "default" # Domain name - Always at 'default' for OVHcloud
alias = "ovh" # An alias
}
provider "ovh" {
alias = "ovh"
endpoint = "ovh-eu"
application_key = "<your_access_key>"
application_secret = "<your_application_secret>"
consumer_key = "<your_consumer_key>"
}