aboutsummaryrefslogtreecommitdiffstats
path: root/deployment/noheat
diff options
context:
space:
mode:
authorMaciej Wereski <m.wereski@partner.samsung.com>2021-07-28 13:19:50 +0000
committerMorgan Richomme <morgan.richomme@orange.com>2021-08-24 13:41:02 +0000
commit0aed89d464d75deb29980b0401b0456ca110b95e (patch)
tree616889ec360a313fcc8f9d9e482f64c62a6e9217 /deployment/noheat
parentd3ca7e0aff94ff066e2f17702adca7a1ac20285f (diff)
noheat: deploy Docker
Issue-ID: INT-1601 Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com> Change-Id: Ieb1bdd761099f707223e8b04f5c117dd86ef6b1f
Diffstat (limited to 'deployment/noheat')
-rw-r--r--deployment/noheat/cluster-rke/ansible/create.yml5
-rw-r--r--deployment/noheat/cluster-rke/ansible/roles/setup_docker/defaults/main.yml3
-rw-r--r--deployment/noheat/cluster-rke/ansible/roles/setup_docker/tasks/main.yml48
3 files changed, 56 insertions, 0 deletions
diff --git a/deployment/noheat/cluster-rke/ansible/create.yml b/deployment/noheat/cluster-rke/ansible/create.yml
index 296bb9536..00e5f230a 100644
--- a/deployment/noheat/cluster-rke/ansible/create.yml
+++ b/deployment/noheat/cluster-rke/ansible/create.yml
@@ -20,3 +20,8 @@
line: "{{ hostvars['nfs0']['ansible_default_ipv4']['address'] }} {{ item }}"
loop:
- "nexus3.onap.org"
+- name: Install Docker
+ become: yes
+ hosts: control,workers
+ roles:
+ - role: setup_docker
diff --git a/deployment/noheat/cluster-rke/ansible/roles/setup_docker/defaults/main.yml b/deployment/noheat/cluster-rke/ansible/roles/setup_docker/defaults/main.yml
new file mode 100644
index 000000000..3ec4af32d
--- /dev/null
+++ b/deployment/noheat/cluster-rke/ansible/roles/setup_docker/defaults/main.yml
@@ -0,0 +1,3 @@
+---
+docker_version: "19.03.15"
+local_user: "ubuntu"
diff --git a/deployment/noheat/cluster-rke/ansible/roles/setup_docker/tasks/main.yml b/deployment/noheat/cluster-rke/ansible/roles/setup_docker/tasks/main.yml
new file mode 100644
index 000000000..29dee312f
--- /dev/null
+++ b/deployment/noheat/cluster-rke/ansible/roles/setup_docker/tasks/main.yml
@@ -0,0 +1,48 @@
+- name: Install deps
+ apt:
+ name: "{{ item }}"
+ state: present
+ with_items:
+ - apt-transport-https
+ - ca-certificates
+ - curl
+ - software-properties-common
+
+- name: Add Docker repo key
+ apt_key:
+ url: "https://download.docker.com/linux/{{ ansible_distribution | lower }}/gpg"
+ state: present
+
+- name: Add Docker repo
+ apt_repository:
+ repo: "deb https://download.docker.com/linux/{{ ansible_distribution | lower }} {{ ansible_distribution_release | lower }} stable"
+ state: present
+ update_cache: yes
+
+- name: Find exact Docker version
+ shell: "apt-cache madison docker-ce | grep {{ docker_version }} | head -n 1 | cut -d ' ' -f 4"
+ register: docker_pkg_version
+
+- name: install Docker
+ apt:
+ name: "{{ item }}"
+ state: present
+ with_items:
+ - "docker-ce={{ docker_pkg_version.stdout }}"
+ - "docker-ce-cli={{ docker_pkg_version.stdout }}"
+
+- name: Lock docker version
+ command: apt-mark hold docker-ce docker-ce-cli
+
+- name: Add user to docker group
+ user:
+ name: "{{ local_user }}"
+ groups: docker
+ append: yes
+ when: local_user is defined
+
+- name: Make sure Docker is started and enabled
+ service:
+ name: docker
+ state: started
+ enabled: yes