object_storage.yml 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. ---
  2. - include: s3.yml
  3. when: openshift_hosted_registry_storage_provider == 's3'
  4. - name: Ensure the registry secret exists
  5. oc_secret:
  6. name: "{{ registry_config_secret_name }}"
  7. state: present
  8. contents:
  9. - path: /tmp/config.yml
  10. data: "{{ lookup('template', 'registry_config.j2') }}"
  11. register: registry_config_out
  12. when: openshift_hosted_registry_storage_gcs_keyfile is not defined
  13. - name: Ensure the registry secret exists for GCS
  14. oc_secret:
  15. name: "{{ registry_config_secret_name }}"
  16. state: present
  17. contents:
  18. - path: /tmp/config.yml
  19. data: "{{ lookup('template', 'registry_config.j2') }}"
  20. - path: /tmp/gcs.json
  21. data: "{{ lookup('file', openshift_hosted_registry_storage_gcs_keyfile) | string }}"
  22. register: registry_config_out
  23. when: openshift_hosted_registry_storage_gcs_keyfile is defined
  24. - name: Add secrets to registry service account
  25. oc_serviceaccount_secret:
  26. service_account: registry
  27. secret: "{{ registry_config_secret_name }}"
  28. namespace: "{{ openshift_hosted_registry_namespace }}"
  29. state: present
  30. register: svcac
  31. - name: Set facts for registry object storage
  32. set_fact:
  33. registry_obj_storage_volume_mounts:
  34. - name: docker-config
  35. path: /etc/registry
  36. type: secret
  37. secret_name: "{{ registry_config_secret_name }}"
  38. registry_obj_storage_env_vars:
  39. REGISTRY_CONFIGURATION_PATH: /etc/registry/config.yml
  40. - name: Update openshift_hosted registry facts for storage
  41. set_fact:
  42. openshift_hosted_registry_volumes: "{{ openshift_hosted_registry_volumes | union(registry_obj_storage_volume_mounts) }}"
  43. openshift_hosted_registry_env_vars: "{{ openshift_hosted_registry_env_vars | combine(registry_obj_storage_env_vars) }}"
  44. openshift_hosted_registry_force: "{{ openshift_hosted_registry_force | union([registry_config_out.changed]) | union([svcac.changed]) }}"