-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DrawDB task #2
base: main
Are you sure you want to change the base?
DrawDB task #2
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--- | ||
- name: Deploy drawdb from GitHub Fork | ||
become: true | ||
|
||
vars: | ||
github_repo: "https://github.com/LIDSOL/drawdb.git" | ||
app_dir: "/app" | ||
|
||
tasks: | ||
|
||
- name: Install programs | ||
apt: | ||
name: git, nodejs, npm, rsync | ||
state: present | ||
when: ansible_distribution == "Debian" | ||
tags: | ||
- 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. has utilizado los tags a la hora de ejecutar el playbook? normalmente los tags son un string que ayuda a filtrar pasos del notebook. Si no los has utilizado, tal vez sea mejor quitarlos |
||
|
||
- name: Clone GitHub repo | ||
git: | ||
repo: "{{ github_repo }}" | ||
dest: "{{ app_dir }}" | ||
force: yes | ||
tags: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yo creo que conviene agregar un paso donde se borren estos archivos al final del playbook (asi podemos correrlo varias veces si es necesario). que piensas? |
||
- 2 | ||
|
||
- name: install dependencies | ||
command: npm install | ||
args: | ||
chdir: "{{ app_dir }}" | ||
tags: | ||
- 3 | ||
|
||
- name: Build app | ||
command: npm run build | ||
args: | ||
chdir: "{{ app_dir }}" | ||
tags: | ||
- 4 | ||
|
||
- name: Install Nginx | ||
apt: | ||
name: nginx | ||
state: latest | ||
when: ansible_distribution == "Debian" | ||
tags: | ||
- 5 | ||
|
||
- name: Enable nginx | ||
service: | ||
name: nginx | ||
enabled: true | ||
state: started | ||
when: ansible_distribution == "Debian" | ||
tags: | ||
- 6 | ||
|
||
- name: Remove contents of /var/www/html | ||
command: rm -r /var/www/html | ||
tags: | ||
- 7 | ||
|
||
- name: Copy build files to prod dir | ||
command: cp -r {{ app_dir }}/dist/ /var/www/html | ||
tags: | ||
- 8 | ||
|
||
- name: Set permissions of /var/www/html | ||
file: | ||
path: /var/www/html | ||
owner: www-data | ||
group: www-data | ||
mode: "0755" | ||
when: ansible_distribution == "Debian" | ||
tags: | ||
- 9 | ||
|
||
- name: Restart nginx | ||
service: | ||
name: nginx | ||
state: restarted | ||
when: ansible_distribution == "Debian" | ||
tags: | ||
- 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
esto corre como root? tal vez sea mejor si utilizas
/tmp/app
para no tener que crear un directorio nuevo en la raiz del filesystem (/
). Que piensas?