summaryrefslogtreecommitdiffstats
path: root/playbooks/adhoc/s3_registry
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks/adhoc/s3_registry')
-rw-r--r--playbooks/adhoc/s3_registry/s3_registry.yml16
1 files changed, 13 insertions, 3 deletions
diff --git a/playbooks/adhoc/s3_registry/s3_registry.yml b/playbooks/adhoc/s3_registry/s3_registry.yml
index 5dc1abf17..4dcef1a42 100644
--- a/playbooks/adhoc/s3_registry/s3_registry.yml
+++ b/playbooks/adhoc/s3_registry/s3_registry.yml
@@ -6,13 +6,14 @@
# 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.
-- hosts: security_group_{{ clusterid }}_master
+- hosts: tag_env-host-type_{{ clusterid }}-openshift-master
remote_user: root
gather_facts: False
vars:
- aws_access_key: "{{ lookup('env', 'AWS_ACCESS_KEY_ID') }}"
- aws_secret_key: "{{ lookup('env', 'AWS_SECRET_ACCESS_KEY') }}"
+ aws_access_key: "{{ lookup('env', 'S3_ACCESS_KEY_ID') }}"
+ aws_secret_key: "{{ lookup('env', 'S3_SECRET_ACCESS_KEY') }}"
+
tasks:
- name: Check for AWS creds
@@ -23,10 +24,16 @@
- aws_access_key
- aws_secret_key
+ - name: Scale down registry
+ command: oc scale --replicas=0 dc/docker-registry
+
- name: Create S3 bucket
local_action:
module: s3 bucket="{{ clusterid }}-docker" mode=create
+ - name: Set up registry environment variable
+ command: oc env dc/docker-registry REGISTRY_CONFIGURATION_PATH=/etc/registryconfig/config.yml
+
- name: Generate docker registry config
template: src="s3_registry.j2" dest="/root/config.yml" owner=root mode=0600
@@ -54,6 +61,9 @@
command: oc volume dc/docker-registry --add --name=dockersecrets -m /etc/registryconfig --type=secret --secret-name=dockerregistry
when: "'dockersecrets' not in dc.stdout"
+ - name: Wait for deployment config to take effect before scaling up
+ pause: seconds=30
+
- name: Scale up registry
command: oc scale --replicas=1 dc/docker-registry