Commit e4a9a12c authored by Walter Heck's avatar Walter Heck Committed by GitHub

Merge pull request #22 from ksatirli/feature/tf-refactor

refactoring Terraform resources
parents a87b8df6 ac89b73f
deploy/vagrant-oscar/.pe_build
deploy/vagrant-oscar/.vagrant
vendor/bundle
terraform.tfstate
# Created by https://www.gitignore.io/api/osx,packer,terraform,windows,ruby,vagrant
### OSX ###
*.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Packer ###
# Cache objects
packer_cache/
# For built boxes
*.box
### Terraform ###
# Compiled files
*.tfstate
*.tfstate.backup
# Module directory
.terraform/
### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
### Ruby ###
*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/
# Used by dotenv library to load environment variables.
# .env
## Specific to RubyMotion:
.dat*
.repl_history
build/
*.bridgesupport
build-iPhoneOS/
build-iPhoneSimulator/
## Specific to RubyMotion (use of CocoaPods):
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# vendor/Pods/
## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/
## Environment normalization:
/.bundle/
/vendor/bundle
/lib/bundler/man/
# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
Gemfile.lock
# .ruby-version
# .ruby-gemset
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc
### Vagrant ###
.vagrant/
### OpsTheater ###
modules/
deploy/vagrant-oscar/.pe_build
deploy/vagrant-oscar/.vagrant
!deploy/packer/manifests/modules
......@@ -4,11 +4,11 @@ If you want to have a look at puppetised code for OpsTheater, you can check that
Please follow the below steps for contributing :
On your development machine (local machine) clone the opstheater control repository using command :
On your development machine clone the `opstheater` repository using command :
```sh
git clone git@gitlab.olindata.com:opstheater/opstheater.git
```
This will create a directory called opstheater on your current location.
This will create a directory called `opstheater` in your current directory.
You can contribute your code in this local directory and push it to a new branch
```sh
checkout -b <author>/[fixes|features]/<name>
......
resource "digitalocean_ssh_key" "opstheater" {
name = "OpsTheater"
public_key = "${file("${var.meta_key_material["global"]}.pub")}"
}
resource "digitalocean_droplet" "host" {
image = "centos-7-0-x64"
name = "${var.host}.${var.domain}"
region = "ams2"
image = "${var.do_droplet_images["centos"]}"
name = "${var.opstheater_host}.${var.opstheater_domain}"
region = "${var.do_regions["global"]}"
size = "512mb"
private_networking = true
backups = "${var.do_droplet_settings["backups"]}"
ipv6 = "${var.do_droplet_settings["ipv6"]}"
private_networking = "${var.do_droplet_settings["private_networking"]}"
ssh_keys = [
"${var.ssh_fingerprint}"
"${digitalocean_ssh_key.opstheater.fingerprint}"
]
connection {
user = "root"
user = "${var.do_droplet_ssh_users["centos"]}"
type = "ssh"
key_file = "${var.pvt_key}"
timeout = "2m"
key_file = "${file(var.meta_key_material["global"])}"
timeout = "${var.do_droplet_settings["private_networking"]}"
}
provisioner "remote-exec" {
inline = [
"export PATH=$PATH:/usr/bin",
"sudo yum update -y -q",
"/bin/yum install -y -q epel-release http://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm",
"/bin/yum install -y -q puppet-agent",
"/opt/puppetlabs/bin/puppet config set --section main server ${var.host}.${var.domain}",
"/opt/puppetlabs/bin/puppet agent -t || true"
"yum update --assumeyes --quiet",
"yum install --assumeyes --quiet epel-release https://yum.puppetlabs.com/puppetlabs-release-pc1-el-7.noarch.rpm",
"yum install --assumeyes --quiet puppet-agent",
"/opt/puppetlabs/bin/puppet config set --section main server ${var.opstheater_host}.${var.opstheater_domain}",
"/opt/puppetlabs/bin/puppet agent --test || true"
]
}
}
variable "do_token" {}
variable "pub_key" {}
variable "pvt_key" {}
variable "ssh_fingerprint" {}
variable "host" {
default = "puppet"
}
variable "domain" {
default = "opstheater.vm"
}
provider "digitalocean" {
token = "${var.do_token}"
}
# DO: generic variables
do_token = "..."
# Section: Digital Ocean
# These variables contain DO-specific data and settings
# see https://terraform.io/docs/providers/do/index.html for more information
variable "do_token" {
description = "Token to work with"
default = ""
}
variable "do_regions" {
description = "Region to work with"
default = {
global = "ams2"
}
}
variable "do_droplet_settings" {
description = "Droplet-specific settings"
default = {
backups = false
ipv6 = false
private_networking = true
timeout = "1m"
}
}
variable "do_droplet_images" {
description = "Droplet Images"
default = {
centos = "centos-7-x64" # CentOS 7.2
}
}
variable "do_droplet_ssh_users" {
description = "Droplet-specific SSH users"
default = {
centos = "root"
}
}
# Section: meta settings
variable "meta_key_material" {
description = "Material for private key (SSH)"
default = {
global = "../../certificates/terraform-20160805"
}
}
variable "opstheater_domain" {
description = "Domain to use for OpsTheater"
default = "opstheater.vm"
}
variable "opstheater_host" {
description = "Host to use for OpsTheater"
default = "puppet"
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment