-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare_vm.yml
executable file
·45 lines (43 loc) · 1.33 KB
/
prepare_vm.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
---
- hosts: all
tasks:
- name: Install dependency for docker engine
package:
name:
- yum-utils
- device-mapper-persistent-data
- lvm2
state: present
- name: Add docker repository
command: |
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
- name: Install docker engine
package:
name:
- docker-ce
- docker-ce-cli
- containerd.io
state: present
- name: Enable docker daemon
systemd:
name: docker
state: started
enabled: yes
- name: Install docker-compose
shell: curl -L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose
- name: Add vagrant to docker group
command: usermod -a -G docker vagrant
- name: Build service
command: /usr/local/bin/docker-compose build --no-cache
args:
chdir: /vagrant/
- name: Start service
command: /usr/local/bin/docker-compose up -d
args:
chdir: /vagrant/
- name: Run django migrations
command: /usr/local/bin/docker-compose exec django python /app/manage.py migrate
args:
chdir: /vagrant/