-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprovision.yml
169 lines (152 loc) · 3.82 KB
/
provision.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
---
- hosts: "{{ hosts | default('ec2') }}"
become: true
vars:
install_docker: true
docker_compose_version: '1.29.0'
tasks:
- name: include vars.yml
include_vars: 'vars.yml'
- name: configure hostname
hostname:
name: "{{ instance_name }}"
- name: install neovim apt-keys
tags:
- packages
apt_key:
keyserver: "{{ item.keyserver }}"
id: "{{ item.id }}"
loop:
- keyserver: keyserver.ubuntu.com
id: 9DBB0BE9366964F134855E2255F96FCF8231B6DD
when:
ansible_os_family == 'Debian'
- name: install docker apt-keys
tags:
- packages
- docker
apt_key:
url: 'https://download.docker.com/linux/ubuntu/gpg'
id: '9DC858229FC7DD38854AE2D88D81803C0EBFCD88'
validate_certs: true
when:
ansible_os_family == 'Debian'
and
install_docker | bool == True
- name: setup docker apt repo
tags:
- packages
- docker
apt_repository:
repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable"
state: present
when:
ansible_os_family == 'Debian'
and
install_docker | bool == True
- name: setup neovim apt repo
tags:
- packages
apt_repository:
repo: 'deb http://ppa.launchpad.net/neovim-ppa/stable/ubuntu {{ ansible_distribution_release }} main'
state: present
when:
ansible_os_family == 'Debian'
- name: Installing common packages
tags:
- packages
package:
name: "{{ packages }}"
state: present
vars:
packages:
- ack
- autofs
- ctags
- curl
- git
- make
- sudo
- tar
- wget
- name: Installing packages
tags:
- packages
apt:
update_cache: true
name: "{{ packages }}"
state: present
vars:
packages:
- apt-transport-https
- neovim
when:
ansible_os_family == 'Debian'
- name: install docker
tags:
- docker
- packages
apt:
update_cache: true
state: present
name: "{{ packages }}"
vars:
packages:
- docker-ce
- docker-ce-cli
- containerd.io
when:
ansible_os_family == 'Debian'
and
install_docker | bool == True
- name: update ubuntu user group to allow running docker
tags:
- docker
- packages
user:
state: present
name: ubuntu
append: true
groups:
- docker
- name: Enable docker service
tags:
- docker
- packages
service:
name: docker
state: started
enabled: true
when:
install_docker | bool == True
- name: Installing docker-compose
tags:
- docker
get_url:
url: 'https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-{{ ansible_system }}-{{ ansible_architecture }}'
dest: /usr/local/bin/docker-compose
owner: root
group: root
mode: '0755'
when:
install_docker | bool == True
- name: push local working directory to ec2
become: false
synchronize:
src: '.'
dest: '/home/ubuntu/'
verify_host: false
compress: true
owner: false
delete: true
rsync_opts:
- '--exclude=.git'
- '--exclude=tmp'
- '--exclude=.pytest_cache'
- '--exclude=.tox'
- '--exclude=*.lcts'
- name: initialize nginx demo
become: false
make:
chdir: '/home/ubuntu/devops-nginx'
target: 'all'