Hello, i have parameterized jobs of aws cli below
The question is, how to pass the meta as multiple arguments?
I want to dispatch job like this:
nomad job dispatch -meta aws_cmd="s3 ls s3://mybucket" aws-cli
job "aws-cli" {
type = "batch"
parameterized {
meta_required = ["aws_cmd"]
}
group "aws-cli" {
network {
mode = "bridge"
}
restart {
attempts = 0
mode = "fail"
}
reschedule {
attempts = 0
unlimited = false
}
task "aws-cli" {
driver = "docker"
shutdown_delay = "10s"
config {
image = "amazon/aws-cli:2.22.4"
command = "{{ env NOMAD_META_aws_cmd | split \"\n\" | first }}"
args = [ "{{ env NOMAD_META_aws_cmd | split \"\n\" | pop }}" ]
volumes = [
"local/.aws_config:/root/.aws/config",
"secrets/.aws_creds:/root/.aws/credentials",
]
}
template {
data = <<EOH
[default]
region = ap-southeast-1
output = json
EOH
destination = "local/.aws_config"
}
template {
data = <<EOH
{{ with nomadVar "nomad/jobs/aws-cli" }}
[default]
aws_access_key_id = {{ .aws_access_key_id }}
aws_secret_access_key = {{ .aws_secret_access_key }}
{{ end }}
EOH
destination = "secrets/.aws_creds"
}
resources {
cpu = 256
memory = 256
memory_max = 512
}
}
}
}