-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplaybook.yaml
123 lines (117 loc) · 3.43 KB
/
playbook.yaml
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
---
- hosts: localhost
connection: local
vars:
server_ip: 125.458.4154.44 # CHANGE THIS
vhost_name: somewebsite.de # CHANGE THIS
project_name: something # CHANGE THIS
local_project_dir: /home/dorian/workspace/regboilerplate/ # CHANGE THIS
remote_project_dir : /var/www/{{vhost_name}}/{{project_name}}/ # OPTIONAL CHANGE
git_repo: [email protected]
tasks:
- name: create fab file
template: src=~/workspace/ansible_templates/fabfile_template.j2 dest={{local_project_dir}}fabfile.py
delegate_to: localhost
- name: create manage.py file
template: src=~/workspace/ansible_templates/manage.j2 dest={{local_project_dir}}manage.py
delegate_to: localhost
- name: create reload file
shell: touch {{local_project_dir}}uwsgi.reload
delegate_to: localhost
#- hosts: webservers
# remote_user: dorian
# vars:
# vhost_name: somewebsite.de # CHANGE THIS
# project_name: somewebsite # CHANGE THIS
# mysql_pw: somepassword # CHANGE THIS
# project_dir : /var/www/{{vhost_name}}/{{project_name}}/
# git_repo: [email protected]
#
# tasks:
# - name: create a nginx v-server
# sudo: yes
# template: src=~/workspace/ansible_templates/nginx_v_server.j2 dest=/etc/nginx/sites-available/{{ vhost_name }}
# notify: restart nginx
# tags:
# - initial
#
# - name: Create symlink for v-server
# sudo: yes
# file: src=/etc/nginx/sites-available/{{ vhost_name }} dest=/etc/nginx/sites-enabled/{{ vhost_name }} state=link
# notify: restart nginx
#
# tags:
# - initial
#
# - name: create uwsgi process
# sudo: yes
# template: src=~/workspace/ansible_templates/uwsgi_template.j2 dest=/etc/uwsgi/apps-available/{{project_name}}.ini
# notify: restart nginx
# tags:
# - initial
#
# - name: Create symlink for uwsgi-process
# sudo: yes
# file: src=/etc/uwsgi/apps-available/{{project_name}}.ini dest=/etc/uwsgi/apps-enabled/{{project_name}}.ini state=link
# notify: restart uwsgi
#
# tags:
# - initial
#
# - name: Create mysql database
# mysql_db: name={{project_name}} state=present login_user=root login_password={{mysql_pw}} collation=utf8_general_ci
#
#
# tags:
# - initial
#
# - name: Create mysql user
# mysql_user: user={{project_name}} password={{mysql_pw}} priv={{project_name}}.*:ALL,GRANT state=present login_user=root login_password={{mysql_pw}}
# tags:
# - initial
#
# - name: Creating Project Folder
# sudo: yes
# file: path=/var/www/{{vhost_name}} state=directory owner={{remote_user}} group={{remote_user}}
# tags:
# - initial
#
# - name: check if virtualenv already exists
# stat: path={{project_dir}}/
# register: venv_dir
# tags:
# - initial
#
#
# - name: create virtualenv for Django web app
# shell: virtualenv /var/www/{{vhost_name}}
# when: venv_dir.stat.isdir is not defined
# tags:
# - initial
#
# - name: Clone repository
# git: repo={{git_repo}} dest={{project_dir}} accept_hostkey=yes
#
# sudo: no
# tags:
# - deploy
#
# - name: install web application dependencies
# pip: requirements={{project_dir}}/requirements/production.txt virtualenv={{project_dir}}/
# notify:
# restart uwsgi
# tags:
# - deploy
#
#
#
# handlers:
# - name: start nginx
# service: name=nginx state=started
#
# - name: restart nginx
# service: name=nginx state=restarted
#
# - name: restart uwsgi
# sudo: yes
# service: name=uwsgi state=restarted