-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker_pb.yaml
71 lines (57 loc) · 1.83 KB
/
docker_pb.yaml
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
- hosts: all
become: true
vars:
docker_compose_version: "1.27.4"
tasks:
- name: Installing dependencies
vars:
packages:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
apt:
name: "{{ packages }}"
state: present
update_cache: yes
- name: Add apt signing key for docker
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Get distribution
command: lsb_release -cs
register: distribution_result
- debug:
msg: "Distribution -> {{distribution_result.stdout}}"
- name: Add apt repository for stable version
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/ubuntu "{{distribution_result.stdout}}" stable
state: present
- name: Installing docker
vars:
packages:
- docker-ce
apt:
name: "{{ packages }}"
state: present
update_cache: yes
- name: Test Docker
shell: "docker run hello-world"
register: container_output
- debug:
msg: "Container Output: {{container_output.stdout}}"
- name: Get docker version
shell: "docker --version"
register: docker_version_output
- debug:
msg: "Docker version: {{docker_version_output.stdout}}"
- name: Installing docker compose
get_url:
url: https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-Linux-x86_64
dest: /usr/local/bin/docker-compose
mode: 755
- name: Get docker compose version
shell: "docker-compose --version"
register: docker_compose_version_output
- debug:
msg: "Docker compose version: {{docker_compose_version_output.stdout}}"