Add "docker-engine" role
authorAlexander Barton <alex@barton.de>
Tue, 22 Sep 2015 11:14:40 +0000 (13:14 +0200)
committerAlexander Barton <alex@barton.de>
Tue, 22 Sep 2015 11:15:06 +0000 (13:15 +0200)
roles/docker-engine/defaults/main.yml [new file with mode: 0644]
roles/docker-engine/files/docker.gpg [new file with mode: 0644]
roles/docker-engine/meta/main.yml [new file with mode: 0644]
roles/docker-engine/tasks/main.yml [new file with mode: 0644]
roles/docker-engine/templates/docker.list.j2 [new file with mode: 0644]

diff --git a/roles/docker-engine/defaults/main.yml b/roles/docker-engine/defaults/main.yml
new file mode 100644 (file)
index 0000000..230a721
--- /dev/null
@@ -0,0 +1,4 @@
+---
+# defaults file for docker-engine
+
+docker_apt_repository: "https://apt.dockerproject.org/repo"
diff --git a/roles/docker-engine/files/docker.gpg b/roles/docker-engine/files/docker.gpg
new file mode 100644 (file)
index 0000000..a81f586
Binary files /dev/null and b/roles/docker-engine/files/docker.gpg differ
diff --git a/roles/docker-engine/meta/main.yml b/roles/docker-engine/meta/main.yml
new file mode 100644 (file)
index 0000000..c289cc5
--- /dev/null
@@ -0,0 +1,5 @@
+---
+# meta file for docker-engine
+
+dependencies:
+  - { role: debian-base }
diff --git a/roles/docker-engine/tasks/main.yml b/roles/docker-engine/tasks/main.yml
new file mode 100644 (file)
index 0000000..46fb78f
--- /dev/null
@@ -0,0 +1,53 @@
+---
+# tasks file for docker-engine
+
+- name: install "apt-transport-https" and "ca-certificates"
+  tags:
+    - docker
+    - packages
+  apt: >
+    name={{ item }}
+    state=installed
+  with_items:
+    - apt-transport-https
+    - ca-certificates
+  when: docker_apt_repository.startswith("https://")
+
+- name: install docker.io repository GnuPG key
+  tags:
+    - docker
+    - packages
+  copy: >
+    dest=/etc/apt/trusted.gpg.d/
+    group=root
+    mode=644
+    owner=root
+    src=docker.gpg
+  notify:
+    - update APT repositories
+
+- name: install docker.io repository configuration
+  tags:
+    - docker
+    - packages
+  template: >
+    dest=/etc/apt/sources.list.d/docker.list
+    group=root
+    mode=644
+    owner=root
+    src=docker.list.j2
+  notify:
+    - update APT repositories
+
+- meta: flush_handlers
+  tags:
+    - docker
+    - packages
+
+- name: install "docker-engine"
+  tags:
+    - docker
+    - packages
+  apt: >
+    name=docker-engine
+    state=installed
diff --git a/roles/docker-engine/templates/docker.list.j2 b/roles/docker-engine/templates/docker.list.j2
new file mode 100644 (file)
index 0000000..5d83334
--- /dev/null
@@ -0,0 +1,6 @@
+# /etc/apt/sources.list.d/docker.list -- docker.io repository configuration
+# ---
+#  {{ ansible_managed }}
+# ---
+
+deb {{docker_apt_repository}} debian-{{ansible_distribution_release}} main