37 lines
843 B
YAML
37 lines
843 B
YAML
---
|
|
# file: roles/docker/tasks/main.yml
|
|
|
|
- name: Add Docker repository
|
|
get_url:
|
|
url: "{{ docker_repo_url }}"
|
|
dest: '/etc/yum.repos.d/docker-ce.repo'
|
|
|
|
- name: Install packages
|
|
package:
|
|
name:
|
|
- docker-ce
|
|
- docker-ce-cli
|
|
- containerd.io
|
|
- docker-compose-plugin
|
|
state: latest
|
|
tags: packages
|
|
|
|
- name: Add manager user to Docker group
|
|
user:
|
|
name: "{{ docker_manager_account }}"
|
|
groups: docker
|
|
append: yes
|
|
when: docker_manager_enabled
|
|
|
|
- name: Configure Docker service options
|
|
copy:
|
|
content: "{{ docker_service_options | to_nice_json }}"
|
|
dest: /etc/docker/daemon.json
|
|
when: docker_service_options.keys() | length > 0
|
|
notify: Restart docker
|
|
|
|
- name: Start and enable Docker
|
|
service:
|
|
name: docker
|
|
state: started
|
|
enabled: yes
|