summaryrefslogtreecommitdiffstats
path: root/ansible/test/roles/prepare-docker-dind
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/test/roles/prepare-docker-dind')
-rw-r--r--ansible/test/roles/prepare-docker-dind/tasks/main.yml26
-rw-r--r--ansible/test/roles/prepare-docker-dind/tasks/rhel.yml24
-rw-r--r--ansible/test/roles/prepare-docker-dind/tasks/ubuntu.yml33
3 files changed, 61 insertions, 22 deletions
diff --git a/ansible/test/roles/prepare-docker-dind/tasks/main.yml b/ansible/test/roles/prepare-docker-dind/tasks/main.yml
index c0bf1543..50efe143 100644
--- a/ansible/test/roles/prepare-docker-dind/tasks/main.yml
+++ b/ansible/test/roles/prepare-docker-dind/tasks/main.yml
@@ -1,24 +1,6 @@
---
-# Needed because host system has all mounts by default to shared, and
-# some things may depend on mounts being shared if we run docker inside
-# test env.
-- name: "Make all mounts shared"
- command: "mount --make-rshared /"
- args:
- warn: false
+- include: rhel.yml
+ when: ansible_distribution in ["CentOS","Red Hat Enterprise Linux"]
-- name: "Enable docker repository"
- yum_repository:
- name: "Docker"
- description: Docker-ce repository
- enabled: yes
- baseurl: "https://download.docker.com/linux/centos/7/$basearch/stable"
- gpgcheck: yes
- gpgkey: https://download.docker.com/linux/centos/gpg
-
-- name: "Install docker"
- package:
- name: "docker-ce-{{ docker_version }}"
- state: present
- allow_downgrade: true
- notify: Restart docker
+- include: ubuntu.yml
+ when: ansible_distribution in ["Ubuntu","Debian"] \ No newline at end of file
diff --git a/ansible/test/roles/prepare-docker-dind/tasks/rhel.yml b/ansible/test/roles/prepare-docker-dind/tasks/rhel.yml
new file mode 100644
index 00000000..4184ef05
--- /dev/null
+++ b/ansible/test/roles/prepare-docker-dind/tasks/rhel.yml
@@ -0,0 +1,24 @@
+---
+# Needed because host system has all mounts by default to shared, and
+# some things may depend on mounts being shared if we run docker inside
+# test env.
+- name: "Make all mounts shared"
+ command: "mount --make-rshared /"
+ args:
+ warn: false
+
+- name: "Enable docker repository - yum"
+ yum_repository:
+ name: "Docker"
+ description: Docker-ce repository
+ enabled: yes
+ baseurl: "https://download.docker.com/linux/centos/7/$basearch/stable"
+ gpgcheck: yes
+ gpgkey: https://download.docker.com/linux/centos/gpg
+
+- name: "Install docker"
+ package:
+ name: "docker-ce-{{ docker_version }}"
+ state: present
+ allow_downgrade: true
+ notify: Restart docker
diff --git a/ansible/test/roles/prepare-docker-dind/tasks/ubuntu.yml b/ansible/test/roles/prepare-docker-dind/tasks/ubuntu.yml
new file mode 100644
index 00000000..a41c4c20
--- /dev/null
+++ b/ansible/test/roles/prepare-docker-dind/tasks/ubuntu.yml
@@ -0,0 +1,33 @@
+---
+# Needed because host system has all mounts by default to shared, and
+# some things may depend on mounts being shared if we run docker inside
+# test env.
+- name: "Make all mounts shared"
+ command: "mount --make-rshared /"
+ args:
+ warn: false
+
+- name: "Install GNUPG for apt-key"
+ package:
+ name: "gnupg"
+ state: present
+
+- name: "Add an apt key"
+ apt_key:
+ url: https://download.docker.com/linux/ubuntu/gpg
+ id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
+ state: present
+
+- name: "Enable docker repository - apt"
+ apt_repository:
+ repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
+ state: present
+ validate_certs: true
+ filename: "Docker"
+
+- name: "Install docker - apt"
+ apt:
+ name: "docker-ce"
+ state: present
+ update_cache: true
+ notify: Restart docker