-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathansible.yml
59 lines (46 loc) · 1.77 KB
/
ansible.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
---
- hosts: all
become: true
remote_user: antonio
vars:
- homeDir: /home/ubuntu
- appDir : tfg_gymapp
- default: server { listen 80; server_name YOUR_SERVERS_IP_ADDRESS; location / { proxy_pass "http://127.0.0.1:80"; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_cache_bypass $http_upgrade; }}
tasks:
#Cambiar por get_curl
- name: Node.js + NPM
shell: "curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -"
- name: Add Mongo Key
apt_key: id=EA312927 keyserver=keyserver.ubuntu.com
- name: Add Mongo Repo
apt_repository: repo='deb http://repo.mongodb.org/apt/ubuntu {{ansible_distribution_release}}/mongodb-org/3.2 multiverse'
- name: Update
become: true
shell: "apt-get update"
- name: Install Packages
apt: name={{ item }} state=latest
with_items:
- build-essential
- git
- mongodb-org
- nginx
- nodejs
- name: PM2 (para mantener Node funcionando)
npm: name=pm2 global=yes
- name: Node.js ln -s
file:
src: /usr/bin/nodejs
dest: /usr/bin/node
force: yes
state: link
- name: Nginx reverse proxy
copy: content="{{ default }}" dest=/etc/nginx/sites-available/default
# La descarga del proyecto y la instalación de las dependencias se ha hecho con Fabric aunque se podria haber hecho aqui
#Realmente no es necesario, ya que vagrant ha copiado el repositorio
# pero lo he realizado para ver como funcionaba. (Desactivado rsync)
# - name: Git Clone Repo
# git: repo=httptfg_gymapp.git dest={{homeDir}}/{{appDir}}
# register: git_finished
# - name: NPM install
# npm: path={{homeDir}}/{{appDir}}/
# when: git_finished.changed