55 lines
1.1 KiB
YAML
55 lines
1.1 KiB
YAML
|
---
|
||
|
- block:
|
||
|
- name: Install packages for Docker
|
||
|
yum:
|
||
|
name:
|
||
|
- device-mapper-persistent-data
|
||
|
- lvm2
|
||
|
- libselinux-python
|
||
|
state: present
|
||
|
|
||
|
- name: add docker-ce repo
|
||
|
yum_repository:
|
||
|
name: docker-ce-stable
|
||
|
file: docker-ce
|
||
|
description: Docker CE Stable - $basearch
|
||
|
enabled: yes
|
||
|
baseurl: https://download.docker.com/linux/centos/7/$basearch/stable
|
||
|
gpgkey: https://download.docker.com/linux/centos/gpg
|
||
|
gpgcheck: yes
|
||
|
when: install_docker_ce_repo == 'yes'
|
||
|
become: yes
|
||
|
|
||
|
- name: Install Docker
|
||
|
package:
|
||
|
name: docker-ce
|
||
|
state: present
|
||
|
become: yes
|
||
|
|
||
|
- name: Create /etc/docker directory
|
||
|
file:
|
||
|
path: /etc/docker
|
||
|
state: directory
|
||
|
|
||
|
- name: Deploy Docker daemon.json
|
||
|
template:
|
||
|
src: daemon.json.j2
|
||
|
dest: /etc/docker/daemon.json
|
||
|
register: daemon_config_result
|
||
|
|
||
|
- name: Start Docker service
|
||
|
service:
|
||
|
name: docker
|
||
|
state: started
|
||
|
enabled: yes
|
||
|
become: yes
|
||
|
|
||
|
- name: Restart Docker
|
||
|
systemd:
|
||
|
state: restarted
|
||
|
name: docker
|
||
|
when: daemon_config_result.changed
|
||
|
|
||
|
tags:
|
||
|
- docker
|