-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook-docker-compose.yml
51 lines (50 loc) · 1.35 KB
/
playbook-docker-compose.yml
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
---
- hosts: localhost
connection: local
become: yes
vars:
admin_user: root
docker_required_packages:
- "apt-transport-https"
- "ca-certificates"
- "curl"
- "gnupg-agent"
- "software-properties-common"
- "python3-pip"
- "python3-setuptools"
docker_gpg_url: https://download.docker.com/linux/ubuntu/gpg
docker_repo: deb https://download.docker.com/linux/ubuntu bionic stable
docker_packges:
- "docker-ce"
- "docker-ce-cli"
- "containerd.io"
tasks:
- name: Update apt-get repo and cache
apt: update_cache=yes force_apt_get=yes cache_valid_time=3600
- name: "Install required packages for docker"
apt:
name: "{{ docker_required_packages }}"
state: latest
update_cache: yes
force_apt_get: yes
- name: "Add Docker GPG key"
apt_key:
url: "{{ docker_gpg_url }}"
state: present
- name: "Add Docker Repository"
apt_repository:
repo: "{{ docker_repo }}"
state: present
- name: "Install Docker"
apt:
name: "{{ docker_packges }}"
state: latest
update_cache: yes
- name: "Install Python Docker Module"
pip:
name: docker
- name: "Install docker compose"
apt:
name: docker-compose
update_cache: yes
force_apt_get: yes