registry_auth.yml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ---
  2. # There might be other settings in this file besides auth; we want to ensure it
  3. # will always be bind-mounted into the node for system containers (atomic).
  4. - name: Check for credentials file for registry auth
  5. stat:
  6. path: "{{ oreg_auth_credentials_path }}"
  7. get_checksum: false
  8. get_attributes: false
  9. get_mime: false
  10. when: oreg_auth_user is defined
  11. register: node_oreg_auth_credentials_stat
  12. # docker_creds is a custom module from lib_utils
  13. # 'docker login' requires a docker.service running on the local host, this is an
  14. # alternative implementation that operates directly on config.json
  15. - name: Create credentials for registry auth
  16. docker_creds:
  17. path: "{{ oreg_auth_credentials_path }}"
  18. registry: "{{ oreg_host }}"
  19. username: "{{ oreg_auth_user }}"
  20. password: "{{ oreg_auth_password }}"
  21. # Test that we can actually connect with provided info
  22. test_login: "{{ oreg_test_login | default(True) }}"
  23. proxy_vars: "{{ l_docker_creds_proxy_vars }}"
  24. test_image: "{{ l_docker_creds_test_image }}"
  25. when:
  26. - oreg_auth_user is defined
  27. register: node_oreg_auth_credentials_create
  28. retries: 3
  29. delay: 5
  30. until: node_oreg_auth_credentials_create is succeeded
  31. - name: Create credentials for any additional registries
  32. docker_creds:
  33. path: "{{ oreg_auth_credentials_path }}"
  34. registry: "{{ item.host }}"
  35. username: "{{ item.user | default('openshift') }}"
  36. password: "{{ item.password }}"
  37. # Test that we can actually connect with provided info
  38. test_login: "{{ item.test_login | default(omit) }}"
  39. proxy_vars: "{{ l_docker_creds_proxy_vars }}"
  40. test_image: "{{ item.test_image | default('openshift3/ose-pod') }}"
  41. tls_verify: "{{ item.tls_verify | default(omit) }}"
  42. when:
  43. - openshift_additional_registry_credentials != []
  44. register: node_additional_registry_creds
  45. retries: 3
  46. delay: 5
  47. until: node_additional_registry_creds is succeeded
  48. with_items:
  49. "{{ openshift_additional_registry_credentials }}"