Packer Redis post processor is a Packer post processor plugin to store builder artifacts metadata into a Redis server for later retrieval.
This project was inspired by Packer Consul post processor.
You first need to install the plugin on your machine and let packer be aware of it.
Run:
$ go get github.com/motymichaely/packer-post-processor-redis
$ go install github.com/motymichaely/packer-post-processor-redis
Copy the binary file into your packer plugins folder:
$ mkdir $HOME/.packer.d/plugins
$ cp $GOPATH/bin/packer-post-processor-redis $HOME/.packer.d/plugins
Add the post-processor to Packer config file (~/.packerconfig
):
{
"post-processors": {
"redis": "packer-post-processor-redis"
}
}
The configuration for this post-processor is extremely simple.
redis_url (string)
- Your access token for the Atlas API. This can be generated on your tokens page. Alternatively you can export your Redis URL as an environmental variable and remove it from the configuration. Note
key_prefix (string)
- The prefix of the key to be set, i.e my_service/images
. for builders that support multiple regions, the prefix will be appended with the region to the key prefix, i.e my_service/images/<region>
.
Add the post-processor to your packer template:
{
"builders": [{
"type": "amazon-ebs",
"region": "us-east-1",
"ami_regions": ["us-east-1", "us-west-1"],
...
}]
"post-processors": [
{
"type": "redis",
"redis_url": "redis://localhost:6379/0",
"key_prefix": "my_service/images",
"only": ["amazonebs"]
}
]
}
This example would take each artifact that was built by the "amazonebs" builder and set the keys my_service/images/us-east-1
and my_service/images/us-west-1
with a value of the image id, i.e ami_5123412
.
Build & Test:
$ make all
Build:
$ make bin
Test:
$ make test
See the CONTRIBUTING file for contribution guidelines.
Copyright (c) 2015 Moty Michaely
See the LICENSE file for license rights and limitations (MIT).