summaryrefslogtreecommitdiffstats
path: root/roles/openshift_node/tasks/registry_auth.yml
blob: f370bb2608c13b6cbbba279c0fe247f17aef23d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
---
- name: Check for credentials file for registry auth
  stat:
    path: "{{ oreg_auth_credentials_path }}"
  when: oreg_auth_user is defined
  register: node_oreg_auth_credentials_stat

# Container images may need the registry credentials
- name: Setup ro mount of /root/.docker for containerized hosts
  set_fact:
    l_bind_docker_reg_auth: True
  when:
    - openshift.common.is_containerized | bool
    - oreg_auth_user is defined
    - (not node_oreg_auth_credentials_stat.stat.exists or oreg_auth_credentials_replace) | bool
  notify:
    - restart node

- name: Create credentials for registry auth
  command: "docker --config={{ oreg_auth_credentials_path }} login -u {{ oreg_auth_user }} -p {{ oreg_auth_password }} {{ oreg_host }}"
  when:
    - oreg_auth_user is defined
    - (not node_oreg_auth_credentials_stat.stat.exists or oreg_auth_credentials_replace) | bool
  notify:
    - restart node