Create dummy module
This commit is contained in:
commit
1c94485587
7 changed files with 156 additions and 0 deletions
44
modules/dummy/jobspec.hcl
Normal file
44
modules/dummy/jobspec.hcl
Normal file
|
@ -0,0 +1,44 @@
|
|||
job "hello-world" {
|
||||
datacenters = ["*"]
|
||||
meta {
|
||||
foo = "bar"
|
||||
}
|
||||
group "servers" {
|
||||
count = 1
|
||||
network {
|
||||
port "www" {
|
||||
to = 8001
|
||||
}
|
||||
}
|
||||
service {
|
||||
provider = "nomad"
|
||||
port = "www"
|
||||
}
|
||||
task "web" {
|
||||
driver = "docker"
|
||||
config {
|
||||
image = "busybox:1"
|
||||
command = "httpd"
|
||||
args = ["-v", "-f", "-p", "${NOMAD_PORT_www}", "-h", "/local"]
|
||||
ports = ["www"]
|
||||
}
|
||||
template {
|
||||
data = <<-EOF
|
||||
<h1>Hello, Nomad!</h1>
|
||||
<ul>
|
||||
<li>Task: {{env "NOMAD_TASK_NAME"}}</li>
|
||||
<li>Group: {{env "NOMAD_GROUP_NAME"}}</li>
|
||||
<li>Job: {{env "NOMAD_JOB_NAME"}}</li>
|
||||
<li>Metadata value for foo: {{env "NOMAD_META_foo"}}</li>
|
||||
<li>Currently running on port: {{env "NOMAD_PORT_www"}}</li>
|
||||
</ul>
|
||||
EOF
|
||||
destination = "local/index.html"
|
||||
}
|
||||
resources {
|
||||
cpu = 50
|
||||
memory = 64
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
56
modules/dummy/jobspec.json
Normal file
56
modules/dummy/jobspec.json
Normal file
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
"ID": "hello-world",
|
||||
"Name": "hello-world",
|
||||
"TaskGroups": [
|
||||
{
|
||||
"Name": "servers",
|
||||
"Tasks": [
|
||||
{
|
||||
"Name": "web",
|
||||
"Driver": "docker",
|
||||
"Config": {
|
||||
"image": "busybox:1",
|
||||
"command": "httpd",
|
||||
"args": [
|
||||
"-v",
|
||||
"-f",
|
||||
"-p",
|
||||
"${NOMAD_PORT_www}",
|
||||
"-h",
|
||||
"/local"
|
||||
],
|
||||
"ports": [
|
||||
"www"
|
||||
]
|
||||
},
|
||||
"Templates": [
|
||||
{
|
||||
"DestPath": "local/index.html",
|
||||
"EmbeddedTmpl": "<h1>Hello, Ben!</h1>\n"
|
||||
}
|
||||
],
|
||||
"Resources": {
|
||||
"CPU": 50,
|
||||
"MemoryMB": 64
|
||||
}
|
||||
}
|
||||
],
|
||||
"Networks": [
|
||||
{
|
||||
"DynamicPorts": [
|
||||
{
|
||||
"Label": "www",
|
||||
"To": 8001
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"Services": [
|
||||
{
|
||||
"PortLabel": "www",
|
||||
"Provider": "nomad"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
4
modules/dummy/main.tf
Normal file
4
modules/dummy/main.tf
Normal file
|
@ -0,0 +1,4 @@
|
|||
resource "nomad_job" "dummy" {
|
||||
jobspec = file("${path.module}/jobspec.json")
|
||||
json = true
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue