summaryrefslogtreecommitdiffstats
path: root/roles/docker/tasks/main.yml
blob: a7bd700a5666d3b29ece365a4bccfb858ef1440b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
- name: Ensure docker is installed
  yum: name="docker" state="present"

- name: start docker
  service: name="docker" state="started"

- name: Configure bridge-nf-call-iptables with sysctl
  sysctl: name="net.bridge.bridge-nf-call-iptables"  value=1 state=present sysctl_set=yes

- name: Configure bridge-nf-call-ip6tables with sysctl
  sysctl: name="net.bridge.bridge-nf-call-ip6tables"  value=1 state=present sysctl_set=yes

- name: Determine if loopback
  shell: docker info | grep 'Data file:.*loop'
  register: loop_device_check
  failed_when: false
  changed_when: loop_device_check.rc == 0

- debug: msg="{{ loop_device_check.stderr }}"
  when: loop_device_check.stderr

- import_tasks: storage.yml
  when: loop_device_check.rc == 0

- name: extend the vg
  lvol: vg="{{ ansible_lvm['lvs'][docker_lv]['vg'] }}" lv="docker_lv" size="{{ docker_volume_size }}"
  when: docker_volume_size is defined

- name: Limit size of container log files
  ghetto_json:
    path: "/etc/docker/daemon.json"
    log-driver: "json-file"
    log-opts.max-size: "{{ docker_max_log_size }}" 
    log-opts.max-file: "{{ docker_max_log_files }}"
  notify:
    - restart docker

- name: start docker
  service: name="docker" enabled=yes state=started