blob: 26089f3677c2674bd0876095d0a34b0eda6bb388 (
plain) (
blame)
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
|
- name: Get host distro
ansible.builtin.setup:
gather_subset:
- distribution
- distribution_major_version
- distribution_release
- os_family
- name: Set platform-specific variables
ansible.builtin.include_vars: "{{ __docker_vars_file }}"
loop:
- "{{ ansible_facts['os_family'] }}.yml"
- "{{ ansible_facts['distribution'] }}.yml"
- "{{ ansible_facts['distribution'] }}_{{ ansible_facts['distribution_major_version'] }}.yml"
vars:
__docker_vars_file: "{{ role_path }}/vars/{{ item }}"
when: __docker_vars_file is exists
- name: Configure Docker logging driver
when: docker_logging_driver is defined and docker_logging_driver
ansible.builtin.include_tasks: logging.yml
- name: Install Docker
become: true
ansible.builtin.package:
name: "{{ docker_package_names }}"
state: present
- name: Enable & start Docker service
become: true
ansible.builtin.systemd_service:
name: "{{ docker_service_name }}"
enabled: true
state: started
- name: Install module dependencies
become: true
ansible.builtin.package:
name: "{{ docker_prune_module_deps }}"
state: present
- name: Clean up Docker data
become: true
community.docker.docker_prune:
builder_cache: true
containers: true
images: true
images_filters:
dangling: false
networks: true
volumes: true
|