s3.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. ---
  2. - name: Assert that S3 variables are provided for registry_config template
  3. assert:
  4. that:
  5. - openshift.hosted.registry.storage.s3.accesskey | default(none) is not none
  6. - openshift.hosted.registry.storage.s3.secretkey | default(none) is not none
  7. - openshift.hosted.registry.storage.s3.bucket | default(none) is not none
  8. - openshift.hosted.registry.storage.s3.region | default(none) is not none
  9. msg: |
  10. When using S3 storage, the following variables are required:
  11. openshift_hosted_registry_storage_s3_accesskey
  12. openshift_hosted_registry_storage_s3_secretkey
  13. openshift_hosted_registry_storage_s3_bucket
  14. openshift_hosted_registry_storage_s3_region
  15. - name: If cloudfront is being used, assert that we have all the required variables
  16. assert:
  17. that:
  18. - "openshift_hosted_registry_storage_s3_cloudfront_privatekeyfile | default(none) is not none"
  19. - "openshift_hosted_registry_storage_s3_cloudfront_keypairid | default(none) is not none"
  20. msg: |
  21. When openshift_hosted_registry_storage_s3_cloudfront_baseurl is provided
  22. openshift_hosted_registry_storage_s3_cloudfront_keypairid and
  23. openshift_hosted_registry_storage_s3_cloudfront_privatekeyfile are required
  24. when: openshift_hosted_registry_storage_s3_cloudfront_baseurl is defined
  25. # Inject the cloudfront private key as a secret when required
  26. - block:
  27. - name: Create registry secret for cloudfront
  28. oc_secret:
  29. state: present
  30. namespace: "{{ openshift_hosted_registry_namespace }}"
  31. name: docker-registry-s3-cloudfront
  32. contents:
  33. - path: cloudfront.pem
  34. data: "{{ lookup('file', openshift_hosted_registry_storage_s3_cloudfront_privatekeyfile) }}"
  35. - name: Append cloudfront secret registry volume to openshift_hosted_registry_volumes
  36. set_fact:
  37. openshift_hosted_registry_volumes: "{{ openshift_hosted_registry_volumes | union(s3_volume_mount) }}"
  38. vars:
  39. s3_volume_mount:
  40. - name: cloudfront-vol
  41. path: /etc/origin
  42. type: secret
  43. secret_name: docker-registry-s3-cloudfront
  44. when: openshift_hosted_registry_storage_s3_cloudfront_baseurl | default(none) is not none