forked from BalaMuragan92/example-voting-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure_docker.yml
78 lines (63 loc) · 1.71 KB
/
azure_docker.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
---
- name: Installation of Docker
hosts: azure
become: yes
vars:
CTOP_VERSION: "0.7.3"
DOCKER_COMPOSE_VERSION: "1.25.1"
DOCKER_PACKAGES:
- apt-transport-https
- ca-certificates
- curl
- gnupg-agent
- software-properties-common
USER: "azureuser"
tasks:
- name: Updating packages
apt:
update_cache: "yes"
force_apt_get: "yes"
- name: Installing packages
apt:
name: "{{DOCKER_PACKAGES}}"
state: present
force_apt_get: "yes"
- name: Adding docker GPG key
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Saving the Ubuntu Release version
shell: lsb_release -cs
register: ubuntu_version
- name: Adding Docker repository
apt_repository:
repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ubuntu_version.stdout}} stable"
state: present
- name: Updating apt-get pacakages
apt:
update_cache: "yes"
force_apt_get: "yes"
- name: Installing Docker
apt:
name: "docker-ce"
state: present
force_apt_get: "yes"
- name: Create Docker group
group:
name: "docker"
state: present
- name: Adding user to docker group
user:
name: "{{USER}}"
group: "docker"
append: "yes"
- name: Testing docker
shell: "docker run hello-world"
register: helloworld_output
- name: Console output from hello world
debug:
msg: "Container output: {{helloworld_output.stdout}}"
# - name: Reboot Azure VM
# shell: "sleep 1 && reboot"
# async: 1
# poll: 0