aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/docker-host
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/roles/docker-host')
-rw-r--r--ansible/roles/docker-host/defaults/main.yml1
-rw-r--r--ansible/roles/docker-host/tasks/main.yml28
2 files changed, 29 insertions, 0 deletions
diff --git a/ansible/roles/docker-host/defaults/main.yml b/ansible/roles/docker-host/defaults/main.yml
new file mode 100644
index 0000000..64fc11d
--- /dev/null
+++ b/ansible/roles/docker-host/defaults/main.yml
@@ -0,0 +1 @@
+docker_host__credentials: []
diff --git a/ansible/roles/docker-host/tasks/main.yml b/ansible/roles/docker-host/tasks/main.yml
new file mode 100644
index 0000000..715a917
--- /dev/null
+++ b/ansible/roles/docker-host/tasks/main.yml
@@ -0,0 +1,28 @@
+- become: yes
+ tags: never,packages
+ apt:
+ name:
+ - docker.io
+ - docker-compose
+ - gnupg2
+ - pass
+ install_recommends: no
+
+- name: Logging in to docker registries
+ loop: "{{ docker_host__credentials }}"
+ become: yes
+ command:
+ cmd: docker login -u "{{ item.username }}" --password-stdin "{{ item.registry }}"
+ stdin: "{{ item.password }}"
+ no_log: yes
+
+- name: Create /etc/docker/daemon.json
+ when: docker_host__daemon_json_content|default("")|length > 0
+ become: yes
+ register: docker_json
+ copy:
+ dest: /etc/docker/daemon.json
+ content: "{{ docker_host__daemon_json_content }}"
+
+- debug: msg="docker.json changed, you must manually restart docker."
+ when: docker_json.changed