Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,34 @@ TODO:
* [ ] Add replication support
* [ ] Add custom schema support


## OpenLDAP Administation

OpenLDAP administration, for adding users and groups, and changing
passwords

* [Documentation](https://www.openldap.org/)
* [Terraform Example](_examples/openldap.tf)
* [Nomad Job](openldap/nomad/openldap.hcl)

TODO:
* [ ] In progress
* [ ] Add TLS support
* [ ] Add replication support
* [ ] Add custom schema support


## PostgreSQL

PostgreSQL is a database server

* [Documentation](https://www.postgresql.org/)
* [Terraform Example](_examples/postgresql.tf)
* [Nomad Job](postgresql/nomad/postgresql.hcl)
* [Documentation](https://github.com/wheelybird/ldap-user-manager)
* [Terraform Example](_examples/openldap-admin.tf)
* [Nomad Job](postgresql/openldap-admin/openldap-admin.hcl)

TODO:
* [ ] LDAP integration
* [ ] Add TLS support
* [ ] Add replication support
* [ ] Use volume instead when the data does not have '/' as prefix
* [ ] Add users, databases and roles support on initialization
* [ ] Add SNMP support

## seaweedfs

Expand Down
23 changes: 23 additions & 0 deletions _examples/openldap-admin.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

// Once the job is running, you should proceed to set-up http://<service_dns>:5000/setup
module "openldap-admin" {
source = "github.com/mutablelogic/tf-nomad//openldap-admin"

// Required parameters
dc = local.datacenter // Nomad datacenter for the cluster
namespace = local.namespace // Nomad namespace for the cluster
hosts = ["cm1"] // Host constraint for the job

// Optional parameters
enabled = true // If false, no-op
port = 5000 // Port to expose
service_dns = ["dns1", "dns2"] // Service discovery DNS

// LDAP parameters
url = "ldap://openldap-ldap.default.nomad:389/"
basedn = format("dc=%s,dc=com",local.organization)
admin_password = local.LDAP_ADMIN_PASSWORD
organization = local.organization
domain = local.domain
debug = false
}
12 changes: 12 additions & 0 deletions openldap-admin/input.tf
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ variable "basedn" {
type = string
}

variable "admin_user" {
description = "LDAP admin user"
type = string
default = "admin"
}

variable "admin_password" {
description = "LDAP admin password"
type = string
Expand All @@ -83,3 +89,9 @@ variable "domain" {
description = "Organization domain"
type = string
}

variable "debug" {
description = "Debug output"
type = bool
default = false
}
3 changes: 2 additions & 1 deletion openldap-admin/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ resource "nomad_job" "openldap" {
jobspec = file("${path.module}/nomad/openldap-admin.hcl")

hcl2 {
allow_fs = true
vars = {
dc = jsonencode([var.dc])
namespace = var.namespace
Expand All @@ -19,9 +18,11 @@ resource "nomad_job" "openldap" {
port = var.port
url = var.url
basedn = var.basedn
admin_user = var.admin_user
admin_password = var.admin_password
organization = var.organization
domain = var.domain
debug = var.debug
}
}
}
20 changes: 19 additions & 1 deletion openldap-admin/nomad/openldap-admin.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ variable "basedn" {
type = string
}

variable "admin_user" {
description = "LDAP admin user"
type = string
default = "admin"
}

variable "admin_password" {
description = "LDAP admin password"
type = string
Expand All @@ -102,6 +108,13 @@ variable "domain" {
type = string
}

///////////////////////////////////////////////////////////////////////////////
// LOCALS

locals {
starttls = substr(lower(trimspace(var.url)), 0, 5) == "ldap:" ? "FALSE" : "TRUE"
}

///////////////////////////////////////////////////////////////////////////////
// JOB

Expand Down Expand Up @@ -144,15 +157,20 @@ job "openldap-admin" {
provider = var.service_provider
}

ephemeral_disk {
migrate = true
}

task "daemon" {
driver = "docker"

env {
LDAP_URI = var.url
LDAP_BASE_DN = var.basedn
LDAP_ADMIN_BIND_DN = format("cn=admin,%s", var.basedn)
LDAP_ADMIN_BIND_DN = format("cn=%s,%s", var.admin_user, var.basedn)
LDAP_ADMIN_BIND_PWD = var.admin_password
LDAP_ADMINS_GROUP = var.admin_group
LDAP_REQUIRE_STARTTLS = local.starttls
LDAP_USER_OU = "users"
LDAP_GROUP_OU = "groups"
NO_HTTPS = "true"
Expand Down