-
Notifications
You must be signed in to change notification settings - Fork 1
/
playbook.yml
108 lines (88 loc) · 2.67 KB
/
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
---
- name: Deploy benspelledabc/django-imrunicorn and stuff
connection: ssh
gather_facts: true
hosts: all
tasks:
- name: Install vim, epel-release, python-pip
yum:
name: 'vim,epel-release,python-pip'
state: latest
- name: Upgrade all packages
yum:
name: '*'
state: latest
- name: Curl install docker
shell: 'curl -fsSL https://get.docker.com/ | sh'
args:
warn: no
creates: /usr/bin/docker
# need to conditionaly do this with a token or something fast.
- name: Install docker-compose
get_url:
url : https://github.com/docker/compose/releases/download/1.27.0-rc2/docker-compose-Linux-x86_64
dest: /usr/local/bin/docker-compose
# mode: 'u+x,g+x,o+x'
mode: '0777'
- name: Enable service docker
service:
name: docker
enabled: yes
- name: Start service docker, if not started
service:
name: docker
state: started
# Create benspelledabc
- name: Add the user 'benspelledabc' and adding to 'docker' group
user:
name: benspelledabc
shell: /bin/bash
groups: docker
append: yes
- name: Create Folder '/data/django/imrunicorn'
file:
path: /data/django/imrunicorn
owner: benspelledabc
group: benspelledabc
mode: 0755
state: directory
- name: Copy Docker-Compose
copy:
src: ./docker-compose.yml
dest: /data/django/imrunicorn/docker-compose.yml
- name: Copy workit.sh
copy:
src: ./workit.sh
dest: /data/django/imrunicorn/workit.sh
mode: 0755
- name: Copy mysql loaddata.cnf
copy:
src: ./loaddata.cnf
dest: /opt/loaddata.cnf
mode: 0644
# - name: Docker - pull benspelledabc/django-imrunicorn:2.4
# docker_image:
# name: benspelledabc/django-imrunicorn
# tag: "2.4"
# source: pull
# - name: Docker - pull mariadb
# docker_image:
# name: mariadb
# source: pull
# - name: Docker - pull adminer
# docker_image:
# name: adminer
# source: pull
- name: Docker - docker-compose up -d
shell: 'docker-compose -f /data/django/imrunicorn/docker-compose.yml up -d'
args:
warn: no
# Wait for port 80 to become open on the host, don't start checking for 10 seconds
- name: Making sure site is up before migrations are done
wait_for:
port: 80
delay: 10
timeout: 300
- name: Work it (make migrations and fix permissions)
shell: '/data/django/imrunicorn/workit.sh'
# - name: curl self into a ball ?