blob: 7240a14c84214e6f11b59c4dff2d15c063889e4d [file] [log] [blame]
Tomáš Levoraa1d3e822018-12-19 15:39:22 +01001---
2- name: Install docker
3 package:
4 name: 'docker-ce'
5 state: present
6 notify:
7 - Restart Docker
8
9- name: Install docker python module
10 package:
11 name: 'python2-docker'
12 state: present
13
14- name: Ensure /etc/docker exists
15 file:
16 path: /etc/docker
17 state: directory
18
Petr Ospalýa22f6b32019-01-07 17:18:29 +010019- name: Resolve the ansible_host address to ip
20 shell: LANG=C ping -n -c1 "{{ hostvars[groups.infrastructure[0]].ansible_host }}" | sed -n 1p | cut -d' ' -f3 | tr -d '()'
21 register: infra_ipv4
22
Tomáš Levoraa1d3e822018-12-19 15:39:22 +010023- name: Setup docker dns settings
24 json_add:
25 path: /etc/docker/daemon.json
26 key: dns
Petr Ospalýa22f6b32019-01-07 17:18:29 +010027 value: "{{ infra_ipv4.stdout }}"
Tomáš Levoraa1d3e822018-12-19 15:39:22 +010028 notify:
29 - Restart Docker
30
31- name: Force notified handlers to run at this point
32 meta: flush_handlers
33
34- name: Ensure docker is started
35 systemd:
36 name: docker
37 state: started
38 enabled: yes