summaryrefslogtreecommitdiffstats
path: root/playbooks/adhoc/s3_registry
diff options
context:
space:
mode:
authortalset <florian.lambert@enovance.com>2016-01-22 17:05:12 +0100
committertalset <florian.lambert@enovance.com>2016-01-28 20:06:34 +0100
commited8717ca91e80a573f22516b8aff0cf387861970 (patch)
tree9d54bd723d925983b34e229ca98f32ac36790368 /playbooks/adhoc/s3_registry
parent74b73d3c83165e45398af8b60eeb25f9d11dd13c (diff)
downloadopenshift-ed8717ca91e80a573f22516b8aff0cf387861970.tar.gz
openshift-ed8717ca91e80a573f22516b8aff0cf387861970.tar.bz2
openshift-ed8717ca91e80a573f22516b8aff0cf387861970.tar.xz
openshift-ed8717ca91e80a573f22516b8aff0cf387861970.zip
Allow to have custom bucket name and region
File playbooks/adhoc/s3_registry/s3_registry* To be able to use a different bucket name and region, aws_bucket and aws_region are now available * Add variable for region and bucket into j2 * Update comment Usage * Add default aws_bucket_name and aws_bucket_region
Diffstat (limited to 'playbooks/adhoc/s3_registry')
-rw-r--r--playbooks/adhoc/s3_registry/s3_registry.j24
-rw-r--r--playbooks/adhoc/s3_registry/s3_registry.yml6
2 files changed, 6 insertions, 4 deletions
diff --git a/playbooks/adhoc/s3_registry/s3_registry.j2 b/playbooks/adhoc/s3_registry/s3_registry.j2
index acfa89515..2972cc3aa 100644
--- a/playbooks/adhoc/s3_registry/s3_registry.j2
+++ b/playbooks/adhoc/s3_registry/s3_registry.j2
@@ -9,8 +9,8 @@ storage:
s3:
accesskey: {{ aws_access_key }}
secretkey: {{ aws_secret_key }}
- region: us-east-1
- bucket: {{ clusterid }}-docker
+ region: {{ aws_bucket_region }}
+ bucket: {{ aws_bucket_name }}
encrypt: true
secure: true
v4auth: true
diff --git a/playbooks/adhoc/s3_registry/s3_registry.yml b/playbooks/adhoc/s3_registry/s3_registry.yml
index d409b4086..0814efae2 100644
--- a/playbooks/adhoc/s3_registry/s3_registry.yml
+++ b/playbooks/adhoc/s3_registry/s3_registry.yml
@@ -1,7 +1,7 @@
---
# This playbook creates an S3 bucket named after your cluster and configures the docker-registry service to use the bucket as its backend storage.
# Usage:
-# ansible-playbook s3_registry.yml -e clusterid="mycluster"
+# ansible-playbook s3_registry.yml -e clusterid="mycluster" -e aws_bucket="clusterid-docker" -e aws_region="us-east-1"
#
# The AWS access/secret keys should be the keys of a separate user (not your main user), containing only the necessary S3 access role.
# The 'clusterid' is the short name of your cluster.
@@ -13,6 +13,8 @@
vars:
aws_access_key: "{{ lookup('env', 'S3_ACCESS_KEY_ID') }}"
aws_secret_key: "{{ lookup('env', 'S3_SECRET_ACCESS_KEY') }}"
+ aws_bucket_name: "{{ aws_bucket | default(clusterid ~ '-docker') }}"
+ aws_bucket_region: "{{ aws_region | lookup('env', 'S3_REGION') | default('us-east-1') }}"
tasks:
@@ -29,7 +31,7 @@
- name: Create S3 bucket
local_action:
- module: s3 bucket="{{ clusterid }}-docker" mode=create
+ module: s3 bucket="{{ aws_bucket_name }}" mode=create
- name: Set up registry environment variable
command: oc env dc/docker-registry REGISTRY_CONFIGURATION_PATH=/etc/registryconfig/config.yml