aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.ansible/roles/docker/tasks/main.yaml
blob: e07b29e3631003298d4cf1dba54775cdef3c9498 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
# file: roles/docker/tasks/main.yaml

- include_tasks: "{{ ansible_distribution_release }}.yaml"
  tags:
    - docker-inst-dependencies

- name: Inst - Docker
  ansible.builtin.package:
    name:
      - "{{ docker_package }}"
      - "{{ docker_package }}-cli"
    state: "{{ docker_package_state }}"
  tags:
    - docker-inst-package

- name: Conf - Docker Service
  ansible.builtin.service:
    name: docker
    state: "{{ docker_service_state }}"
    enabled: "{{ docker_service_enabled }}"
  when:
    - docker_service_mgr == "systemd"
  tags:
    - docker-conf-service

- name: Conf - Docker Service Directory
  ansible.builtin.file:
    path: "/etc/systemd/system/docker.service.d"
    state: "directory"
    mode: "0755"
  when:
    - docker_service_mgr == "systemd"
  tags:
    - docker-conf-service

- name: Conf - Docker Daemon
  ansible.builtin.template:
    src: "templates/daemon.json.j2"
    dest: "/etc/docker/daemon.json"
    owner: "root"
    group: "root"
    mode: "0644"
  notify:
    - "Restart Docker"
  when: >
    docker_daemon is defined and
    docker_service_mgr == "systemd"
  tags:
    - docker-conf-daemon

- name: Conf - Docker HTTP Proxy
  ansible.builtin.template:
    src: "templates/docker.service.proxy.http"
    dest: "/etc/systemd/system/docker.service.d/http-proxy.conf"
    owner: "root"
    group: "root"
    mode: "0644"
  notify:
    - "Restart Docker"
  when: >
    proxy_env is defined and
    proxy_env.http_proxy is defined and
    docker_service_mgr == "systemd"
  tags:
    - docker-conf-service

- name: Conf - Docker HTTPS Proxy
  ansible.builtin.template:
    src: "templates/docker.service.proxy.https"
    dest: "/etc/systemd/system/docker.service.d/https-proxy.conf"
    owner: "root"
    group: "root"
    mode: "0644"
  notify:
    - "Restart Docker"
  when: >
    proxy_env is defined and
    proxy_env.https_proxy is defined and
    docker_service_mgr == "systemd"
  tags:
    - docker-conf-service

- name: Meta - Flush handlers
  ansible.builtin.meta: flush_handlers