templates-s3

store templates on S3


Keywords
templates, s3, aws, cli
License
Unlicense
Install
pip install templates-s3==2020.12.3

Documentation

Installation

$ [sudo] pip install templates-s3
$ [sudo] npm i -g templates-s3

Pros

  • store templates on S3 - no need rebuild docker image

How it works

templates/ hard-coded folder

scripts:

  • create full-access/read-only user and credentials
  • upload/download templates/

hard-coded environment variables names:

  • AWS_S3_TEMPLATES_BUCKET
  • AWS_S3_TEMPLATES_USER
  • AWS_S3_TEMPLATES_ACCESS_KEY_ID
  • AWS_S3_TEMPLATES_SECRET_ACCESS_KEY

Examples

Makefile, create env

TEMPLATES_BUCKET:=BUCKET_NAME
all:
    test -s .env.s3.templates || templates-s3-create-full-access-env $(TEMPLATES_BUCKET) > .env.s3.templates
    test -s .env.prod.templates || templates-s3-create-read-only-env $(TEMPLATES_BUCKET) > .env.prod.templates

upload templates/ to S3

set -o allexport
. .env.s3.templates || exit

templates-s3-upload

Dockerfile

ENTRYPOINT ["/bin/sh","/entrypoint.sh"]

entrypoint.sh

templates-s3-download
...

ansible-playbook.yml

...
  tasks:
  - name: task_name
    docker_container:
      ...
      env_file: ".env.prod"

readme42.com