Add ansible tasks

This commit is contained in:
2016-08-27 10:37:49 +03:00
parent dc3d92a792
commit 582ee4342b
14 changed files with 127 additions and 0 deletions

View File

@ -0,0 +1,3 @@
---
- name: restart nginx
service: name=nginx enabled=yes state=restarted

View File

@ -0,0 +1,33 @@
---
- name: Install Nginx
become: yes
apt: pkg=nginx state=latest
- name: Create nginx congig
become: yes
template:
src: homepage.tpl
dest: /etc/nginx/sites-available/{{ site.domain }}
notify: restart nginx
- name: Create symlink to site
become: yes
file:
src: /etc/nginx/sites-available/{{ site.domain }}
dest: /etc/nginx/sites-enabled/{{ site.domain }}
state: link
notify: restart nginx
- name: Delete default site
become: yes
file:
path: /etc/nginx/sites-available/default
state: absent
notify: restart nginx
- name: Delete default site symlink
become: yes
file:
path: /etc/nginx/sites-enabled/default
state: absent
notify: restart nginx

View File

@ -0,0 +1,10 @@
server {
listen 80;
server_name {{ site.domain }} www.{{ site.domain }};
location / {
root /var/www/{{ site.www_dir }}/current/web;
index index.html;
try_files $uri /index.html;
}
}

View File

@ -0,0 +1,25 @@
---
- name: Update apt
sudo: yes
apt: update_cache=yes
- name: Install System Packages
sudo: yes
apt: pkg={{ item }} state=latest
with_items:
- curl
- wget
- python-software-properties
- git
- name: Configure the timezone
sudo: yes
template: src=timezone.tpl dest=/etc/timezone
- name: Configure the timezone
sudo: yes
file: src=/usr/share/zoneinfo/{{ server.timezone }} dest=/etc/localtime state=link force=yes backup=yes
- name: Set default system language pack
shell: locale-gen {{ server.locale }}
sudo: yes

View File

@ -0,0 +1 @@
{{ server.timezone }}