registry_auth.yml 1.0 KB

123456789101112131415161718192021222324252627
  1. ---
  2. - name: Check for credentials file for registry auth
  3. stat:
  4. path: "{{ oreg_auth_credentials_path }}"
  5. when: oreg_auth_user is defined
  6. register: node_oreg_auth_credentials_stat
  7. - name: Create credentials for registry auth
  8. command: "docker --config={{ oreg_auth_credentials_path }} login -u {{ oreg_auth_user }} -p {{ oreg_auth_password }} {{ oreg_host }}"
  9. when:
  10. - oreg_auth_user is defined
  11. - (not node_oreg_auth_credentials_stat.stat.exists or oreg_auth_credentials_replace) | bool
  12. register: node_oreg_auth_credentials_create
  13. retries: 3
  14. delay: 5
  15. until: node_oreg_auth_credentials_create.rc == 0
  16. notify:
  17. - restart node
  18. # Container images may need the registry credentials
  19. - name: Setup ro mount of /root/.docker for containerized hosts
  20. set_fact:
  21. l_bind_docker_reg_auth: True
  22. when:
  23. - openshift.common.is_containerized | bool
  24. - oreg_auth_user is defined
  25. - (node_oreg_auth_credentials_stat.stat.exists or oreg_auth_credentials_replace or node_oreg_auth_credentials_create.changed) | bool