-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-frontend-ansible.yml
More file actions
51 lines (43 loc) · 1.36 KB
/
deploy-frontend-ansible.yml
File metadata and controls
51 lines (43 loc) · 1.36 KB
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
---
- hosts: webserver
become: yes
tasks:
- name: Instalar Nginx
package:
name: nginx
state: latest
- name: Instalar Node.Js v.14
shell: |
node -v || curl -sL https://deb.nodesource.com/setup_12.x | sudo bash - && apt -y install nodejs
- name: Instalar NPM
shell: |
npm -v || apt install npm
- name: Clonar repositorio do GitHub
shell: |
if [ ! -d /main-folder/build-folder ]; then
mkdir -p /main-folder/build-folder
cd /main-folder/build-folder
git clone https://github.com/giovana-git/deployfrontend.git
fi
- name: Comando npm install
shell: |
cd /main-folder/build-folder/deployfrontend
if [ ! -d /main-folder/build-folder/deployfrontend/node_modules ]; then
npm install
fi
- name: Comando npm run build
shell: |
if [ ! -d /main-folder/build-folder/deployfrontend/build ]; then
cd /main-folder/build-folder/deployfrontend
npm run build
fi
- name: Mover arquivo Build para /var/www/html
shell: |
if [ ! -d /var/www/html/static ]; then
cp -r /main-folder/build-folder/deployfrontend/build/* /var/www/html/
fi
- name: Restarting Nginx
service:
name: nginx
enabled: yes
state: restarted