aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.ansible/roles/docker/tasks/main.yaml
blob: 25c9ea42ec4aaffe8d0693acb859c74077706551 (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
---
# file: tasks/main.yaml

- name: "Install Prerequisites Based on OS"
  ansible.builtin.include_tasks:
    file: "{{ item }}"
  with_first_found:
    - files:
        - "{{ ansible_os_family }}.yaml"
        - "default.yaml"
  tags:
    - docker-inst-dependencies

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

- name: "Enable 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: "Configure 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: "Meta - Flush handlers"
  ansible.builtin.meta: flush_handlers