1
0

Add configuration for primary vds

This commit is contained in:
Anton Vakhrushev 2017-07-30 15:23:01 +03:00
commit 7e81d6fe00
12 changed files with 109 additions and 0 deletions

13
.editorconfig Normal file
View File

@ -0,0 +1,13 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
[*.{yml}]
indent_size = 2
[Makefile]
indent_style = tab

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/ansible/galaxy.roles/

2
Makefile Normal file
View File

@ -0,0 +1,2 @@
configure:
ansible-playbook --inventory "ansible/hosts_prod" --user=av --ask-become-pass ansible/configuration.yml

2
ansible.cfg Normal file
View File

@ -0,0 +1,2 @@
[defaults]
roles_path = ./ansible/galaxy.roles

14
ansible/configuration.yml Normal file
View File

@ -0,0 +1,14 @@
---
- hosts: all
become: true
vars:
timezone: UTC
nginx_remove_default_vhost: true
roles:
- yatesr.timezone
- geerlingguy.nginx
- server
- site-anwinged
- site-s2photo

1
ansible/hosts_prod Normal file
View File

@ -0,0 +1 @@
188.225.32.183

6
ansible/requirements.yml Normal file
View File

@ -0,0 +1,6 @@
---
- src: yatesr.timezone
version: 1.0.0
- src: geerlingguy.nginx
version: 1.9.6

View File

@ -0,0 +1,16 @@
---
- name: Update apt cache
apt: update_cache=yes
- name: Install system packages
apt: pkg={{ item }} state=latest
with_items:
- curl
- wget
- python-software-properties
- git
- name: Add deploy user
user:
name: deployer
groups: www-data

View File

@ -0,0 +1,15 @@
---
- name: Create nginx config
template:
src: site.conf.j2
dest: /etc/nginx/sites-enabled/anwinged.conf
notify: restart nginx
- name: Create root folder
file:
path: /var/www/anwinged
state: directory
owner: deployer
group: www-data
recurse: yes
notify: restart nginx

View File

@ -0,0 +1,15 @@
server {
server_name www.anwinged.ru;
return 301 $scheme://anwinged.ru$request_uri;
}
server {
listen 80;
server_name anwinged.ru;
location / {
root /var/www/anwinged/current;
index index.html;
try_files $uri $uri/ =404;
}
}

View File

@ -0,0 +1,14 @@
---
- name: Create nginx config
template:
src: site.conf.j2
dest: /etc/nginx/sites-enabled/s2photo.conf
notify: restart nginx
- name: Create root folder
file:
path: /var/www/s2photo
state: directory
owner: deployer
group: deployer
mode: u=rw,g=r,o=r

View File

@ -0,0 +1,10 @@
server {
listen 80;
server_name s2photo.ru www.s2photo.ru;
location / {
root /var/www/s2photo/current;
index index.html;
try_files $uri $uri/ =404;
}
}