docker/tasks/main.yml

33 lines
775 B
YAML
Raw Normal View History

2022-05-31 18:52:46 +00:00
- name: Include OS-specific variables.
include_vars: "{{ ansible_os_family }}.yml"
- name: Add CentOS repository
block:
- name: Add Docker repository.
get_url:
url: "https://download.docker.com/linux/centos/docker-ce.repo"
dest: '/etc/yum.repos.d/docker-ce.repo'
owner: root
group: root
mode: 0644
when: ansible_os_family == "RedHat"
become: true
2019-10-06 15:31:59 +00:00
- name: Install Docker.
package:
2022-05-31 18:52:46 +00:00
name: "{{ docker_package }}"
2019-10-06 15:31:59 +00:00
state: present
notify: restart docker
2020-07-05 10:12:10 +00:00
become: true
2019-10-06 15:31:59 +00:00
- name: Ensure Docker is started and enabled at boot.
service:
name: docker
state: "{{ docker_service_state }}"
enabled: "{{ docker_service_enabled }}"
2020-07-05 10:12:10 +00:00
become: true
2019-10-06 15:31:59 +00:00
- include_tasks: docker-users.yml
when: docker_users | length > 0