diff options
author | Michael Gugino <mgugino@redhat.com> | 2017-08-31 18:01:56 -0400 |
---|---|---|
committer | Michael Gugino <mgugino@redhat.com> | 2017-09-25 09:40:01 -0400 |
commit | 82d61ae9e23c2ae1f722ed3b458a6e39721e71fd (patch) | |
tree | 54b79f1033aa3d210597e285e1346239ce7fad86 /roles/openshift_hosted/tasks/storage/object_storage.yml | |
parent | c390d382a2c1783964179490eec810ee2206fa32 (diff) | |
download | openshift-82d61ae9e23c2ae1f722ed3b458a6e39721e71fd.tar.gz openshift-82d61ae9e23c2ae1f722ed3b458a6e39721e71fd.tar.bz2 openshift-82d61ae9e23c2ae1f722ed3b458a6e39721e71fd.tar.xz openshift-82d61ae9e23c2ae1f722ed3b458a6e39721e71fd.zip |
Refactor openshift_hosted plays and role
Currently, openshift_hosted role duplicates some logic
across separate task chains. This commit cleans up
the openshift_hosted role and converts it to be
primarily used with include_role to give better
logic to the playbooks that utilize this role.
This commit also refactors the playbook that calls
various openshift_hosted roles into individual playbooks.
This allows more granularity for advanced users.
Diffstat (limited to 'roles/openshift_hosted/tasks/storage/object_storage.yml')
-rw-r--r-- | roles/openshift_hosted/tasks/storage/object_storage.yml | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/roles/openshift_hosted/tasks/storage/object_storage.yml b/roles/openshift_hosted/tasks/storage/object_storage.yml new file mode 100644 index 000000000..8553a8098 --- /dev/null +++ b/roles/openshift_hosted/tasks/storage/object_storage.yml @@ -0,0 +1,49 @@ +--- +- include: s3.yml + when: openshift.hosted.registry.storage.provider == 's3' + +- name: Ensure the registry secret exists + oc_secret: + name: "{{ registry_config_secret_name }}" + state: present + contents: + - path: /tmp/config.yml + data: "{{ lookup('template', 'registry_config.j2') }}" + register: registry_config_out + when: openshift_hosted_registry_storage_gcs_keyfile is not defined + +- name: Ensure the registry secret exists for GCS + oc_secret: + name: "{{ registry_config_secret_name }}" + state: present + contents: + - path: /tmp/config.yml + data: "{{ lookup('template', 'registry_config.j2') }}" + - path: /tmp/gcs.json + data: "{{ lookup('file', openshift_hosted_registry_storage_gcs_keyfile) | string }}" + register: registry_config_out + when: openshift_hosted_registry_storage_gcs_keyfile is defined + +- name: Add secrets to registry service account + oc_serviceaccount_secret: + service_account: registry + secret: "{{ registry_config_secret_name }}" + namespace: "{{ openshift_hosted_registry_namespace }}" + state: present + register: svcac + +- name: Set facts for registry object storage + set_fact: + registry_obj_storage_volume_mounts: + - name: docker-config + path: /etc/registry + type: secret + secret_name: "{{ registry_config_secret_name }}" + registry_obj_storage_env_vars: + REGISTRY_CONFIGURATION_PATH: /etc/registry/config.yml + +- name: Update openshift_hosted registry facts for storage + set_fact: + openshift_hosted_registry_volumes: "{{ openshift_hosted_registry_volumes | union(registry_obj_storage_volume_mounts) }}" + openshift_hosted_registry_env_vars: "{{ openshift_hosted_registry_env_vars | combine(registry_obj_storage_env_vars) }}" + openshift_hosted_registry_force: "{{ openshift_hosted_registry_force | union([registry_config_out.changed]) | union([svcac.changed]) }}" |