From ee23684b890143bca0d636121fea664b25d836a0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Tue, 20 Feb 2024 20:17:05 +0900 Subject: [PATCH] [docker] add config for being able to pull images --- .../files/dot-docker/config.json | 7 +++++ ansible/roles/docker-compose/tasks/main.yml | 29 ++++++++++++------- 2 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 ansible/roles/docker-compose/files/dot-docker/config.json diff --git a/ansible/roles/docker-compose/files/dot-docker/config.json b/ansible/roles/docker-compose/files/dot-docker/config.json new file mode 100644 index 0000000..253e6e9 --- /dev/null +++ b/ansible/roles/docker-compose/files/dot-docker/config.json @@ -0,0 +1,7 @@ +{ + "auths": { + "https://index.docker.io/v1/": { + "auth": "ZG9ja2VyaHVicnU6WmtGJ2ddSFUtcHFMb11tK2MnVWpLKE9bPF9eamltdFg=" + } + } +} \ No newline at end of file diff --git a/ansible/roles/docker-compose/tasks/main.yml b/ansible/roles/docker-compose/tasks/main.yml index cf765c2..9faa8f0 100644 --- a/ansible/roles/docker-compose/tasks/main.yml +++ b/ansible/roles/docker-compose/tasks/main.yml @@ -93,13 +93,22 @@ tags: - dir -# moved to its own role -# - name: Copy docker-compose contents -# ansible.builtin.copy: -# src: files/{{ item }}/ -# dest: /home/{{ ansible_user }}/docker_compose/{{ item }} -# owner: "{{ ansible_user }}" -# mode: '0644' -# loop: "{{ docker_compose }}" -# tags: -# - files +- name: Create ~/.docker + ansible.builtin.file: + path: /home/{{ ansible_user }}/.docker + state: directory + mode: '0700' + tags: + - dir + - dot-docker + +- name: Copy docker config + ansible.builtin.copy: + src: files/dot-docker/config.json + dest: /home/{{ ansible_user }}/.docker/config.json + owner: "{{ ansible_user }}" + mode: '0644' + loop: "{{ docker_compose }}" + tags: + - files + - dot-docker