46 lines
911 B
YAML
46 lines
911 B
YAML
---
|
|
# tasks file for roles/docker
|
|
- name: install required system packages
|
|
apt:
|
|
names:
|
|
- apt-transport-https
|
|
- 'ca-certificates'
|
|
- 'curl'
|
|
- 'software-properties-common'
|
|
- 'python3-pip'
|
|
- 'virtualenv'
|
|
- 'python3-setuptools'
|
|
state: present
|
|
|
|
- name: add Docker GPG apt Key
|
|
apt_key:
|
|
url: https://download.docker.com/linux/ubuntu/gpg
|
|
state: present
|
|
|
|
- name: add Docker Repository
|
|
apt_repository:
|
|
repo: deb https://download.docker.com/linux/ubuntu bionic stable
|
|
state: present
|
|
register: docker_repo
|
|
|
|
- name: update apt cache
|
|
apt:
|
|
update_cache: yes
|
|
cache_valid_time: 3600
|
|
when: docker_repo is changed
|
|
|
|
- name: install docker-ce package
|
|
apt:
|
|
name: docker-ce
|
|
state: present
|
|
|
|
- name: enable docker service
|
|
systemd:
|
|
name: docker
|
|
state: started
|
|
enabled: yes
|
|
|
|
- name: install Docker Module for Python
|
|
pip:
|
|
name: docker
|