Ansible tasks to set up web user, install Node
This commit is contained in:
parent
a915bc4b49
commit
537aeb4118
3 changed files with 38 additions and 5 deletions
|
@ -1,2 +1,3 @@
|
|||
# There is currently only one impress-2020 box in our Ansible inventory!
|
||||
[webserver]
|
||||
impress-2020-box.openneo.net
|
||||
|
|
|
@ -1,6 +1,38 @@
|
|||
---
|
||||
- name: My task
|
||||
hosts: all
|
||||
- name: Install the impress-2020 app
|
||||
hosts: webserver
|
||||
tasks:
|
||||
- name: Leaving a mark
|
||||
command: "touch /tmp/ansible_was_here"
|
||||
- name: Create web user group
|
||||
become: yes
|
||||
group:
|
||||
name: web
|
||||
- name: Add current user to web group
|
||||
become: yes
|
||||
user:
|
||||
name: "{{ ansible_user_id }}"
|
||||
group: web
|
||||
append: yes
|
||||
- name: Create the app folder
|
||||
become: yes
|
||||
file:
|
||||
path: /srv/impress-2020
|
||||
state: directory
|
||||
# Root and the `web` group may read/write this folder. Everyone else
|
||||
# may only read it.
|
||||
group: web
|
||||
mode: "u=rwx,g=rwx,o=rx"
|
||||
- name: Add Nodesource apt key
|
||||
become: yes
|
||||
apt_key:
|
||||
id: 9FD3B784BC1C6FC31A8A0A1C1655A0AB68576280
|
||||
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
|
||||
- name: Add Node v16 apt repository
|
||||
become: yes
|
||||
apt_repository:
|
||||
repo: deb https://deb.nodesource.com/node_16.x focal main
|
||||
- name: Install Node v16
|
||||
become: yes
|
||||
apt:
|
||||
update_cache: yes
|
||||
name: nodejs
|
||||
state: present
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
"vercel-build": "yum install libuuid-devel libmount-devel && cp /lib64/{libuuid,libmount,libblkid}.so.1 node_modules/canvas/build/Release/",
|
||||
"test": "jest test --env=jsdom",
|
||||
"lint": "next lint --dir src --dir pages",
|
||||
"deploy-setup": "ansible-playbook -i deploy/inventory.cfg deploy/setup.yml",
|
||||
"deploy-setup": "echo $'Setup requires you to become the root user. You\\'ll need to enter the password for your account on the remote web server below, and you must be part of the `sudoers` user group.' && ansible-playbook -K -i deploy/inventory.cfg deploy/setup.yml",
|
||||
"cypress": "cypress open",
|
||||
"mysql": "mysql --host=impress.openneo.net --user=$(dotenv -p IMPRESS_MYSQL_USER) --password=$(dotenv -p IMPRESS_MYSQL_PASSWORD) --database=openneo_impress",
|
||||
"mysql-dev": "mysql --host=localhost --user=impress_2020_dev --password=impress_2020_dev --database=impress_2020_dev",
|
||||
|
|
Loading…
Reference in a new issue