summaryrefslogtreecommitdiffstats
path: root/ansible/roles
diff options
context:
space:
mode:
authorTomáš Levora <t.levora@partner.samsung.com>2018-12-19 15:39:22 +0100
committerTomáš Levora <t.levora@partner.samsung.com>2018-12-19 15:44:48 +0100
commita1d3e82d9094a1b0947c2ab154c8f8c3e217adfb (patch)
tree2db0a2a8b5adc383d3ebb0f9f6bde86e274208b7 /ansible/roles
parent788be5eb73d8213a450050e149cfa34d670e4ffa (diff)
Add ansible role for docker installation
Adding ansible role for installation of docker and its setup Issue-ID: OOM-1551 Change-Id: I49bca8eab46a2750cd627cbf709bed6744c88df5 Signed-off-by: Tomáš Levora <t.levora@partner.samsung.com>
Diffstat (limited to 'ansible/roles')
-rw-r--r--ansible/roles/docker/handlers/main.yml6
-rw-r--r--ansible/roles/docker/tasks/main.yml34
2 files changed, 40 insertions, 0 deletions
diff --git a/ansible/roles/docker/handlers/main.yml b/ansible/roles/docker/handlers/main.yml
new file mode 100644
index 00000000..5df47e8d
--- /dev/null
+++ b/ansible/roles/docker/handlers/main.yml
@@ -0,0 +1,6 @@
+---
+- name: Restart Docker
+ systemd:
+ name: docker
+ state: restarted
+ enabled: yes
diff --git a/ansible/roles/docker/tasks/main.yml b/ansible/roles/docker/tasks/main.yml
new file mode 100644
index 00000000..28c322c3
--- /dev/null
+++ b/ansible/roles/docker/tasks/main.yml
@@ -0,0 +1,34 @@
+---
+- name: Install docker
+ package:
+ name: 'docker-ce'
+ state: present
+ notify:
+ - Restart Docker
+
+- name: Install docker python module
+ package:
+ name: 'python2-docker'
+ state: present
+
+- name: Ensure /etc/docker exists
+ file:
+ path: /etc/docker
+ state: directory
+
+- name: Setup docker dns settings
+ json_add:
+ path: /etc/docker/daemon.json
+ key: dns
+ value: "{{ hostvars[groups.infrastructure[0]].ansible_host }}"
+ notify:
+ - Restart Docker
+
+- name: Force notified handlers to run at this point
+ meta: flush_handlers
+
+- name: Ensure docker is started
+ systemd:
+ name: docker
+ state: started
+ enabled: yes