-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy_iotplatform_playbook.yml
110 lines (82 loc) · 3.01 KB
/
deploy_iotplatform_playbook.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
---
# ------------------------
# Deploy the general stuff
# ------------------------
- hosts: "{{ hostname }}"
become: yes
# strategy: debug
vars_files:
- vars/main.yml
pre_tasks:
- name: Update APT cache
apt: update_cache=yes
tasks:
# General tasks
# - name: install virtualenv
# apt: name=python-virtualenv state=present update_cache=yes
- name: disable net.ipv6.conf.all.disable_ipv6
sysctl: name=net.ipv6.conf.all.disable_ipv6 value=1 state=present
- name: disable net.ipv6.conf.default.disable_ipv6
sysctl: name=net.ipv6.conf.default.disable_ipv6 value=1 state=present
- name: disable net.ipv6.conf.lo.disable_ipv6
sysctl: name=net.ipv6.conf.lo.disable_ipv6 value=1 state=present
- name: distribute host file
template: src=templates/hosts.j2 dest=/etc/hosts
# Install prerequisites
- name: Install apt-transport-https, ca-certificates, curl, software-properties-common, ppa-purge
apt: name={{ item }} update_cache=yes state=latest
with_items:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
- ppa-purge
- name: Download gpg key
command: curl -fsSL -o /home/ubuntu/gpg https://download.docker.com/linux/ubuntu/gpg
- name: Add apt key
command: apt-key add /home/ubuntu/gpg
- name: Apt key fingerprint
command: apt-key fingerprint 0EBFCD88
- name: Check lsb_release
command: lsb_release -cs
register: lsb_rel
- name: Check uname -s
command: uname -s
register: uname_s
- name: Check uname -m
command: uname -m
register: uname_m
- debug:
msg: "{{ lsb_rel.stdout }}"
- debug:
msg: "{{ uname_s.stdout }}"
- debug:
msg: "{{ uname_m.stdout }}"
- name: Add apt-key repository
command: add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu "{{ lsb_rel.stdout }}" stable"
- name: Update repositories cache
apt:
update_cache: yes
- name: Install docker-ce
apt: name={{ item }} update_cache=yes state=latest
with_items:
- docker-ce
- name: Install docker-compose
command: curl -o /usr/local/bin/docker-compose -L https://github.com/docker/compose/releases/download/1.13.0/docker-compose-"{{ uname_s.stdout }}"-"{{ uname_m.stdout }}"
# change permission to a file
- name: Changing perm of "/usr/local/bin/docker-compose", adding "+x"
file: dest=/usr/local/bin/docker-compose mode=a+x
- name: Delete unused files
file: path=/home/ubuntu/gpg state=absent
- name: Check docker version
command: docker -v
register: docker
- name: Check docker-compose version
command: docker-compose -v
register: docker_compose
- debug:
msg: "{{ docker.stdout }}"
- debug:
msg: "{{ docker_compose.stdout }}"
- name: Deploy docker compose file
template: src=templates/docker-compose.yml.j2 dest=/home/ubuntu/docker-compose.yml