nodejs: add 3 tasks + install procedure

This commit is contained in:
Bruno TATU 2018-02-01 10:49:17 +01:00
parent ed81597b06
commit cff9900d94
3 changed files with 33 additions and 3 deletions

View file

@ -9,3 +9,19 @@ Everything is in the `tasks/main.yml` file.
## Variables
* `nodejs_apt_version`: version for the repository (default: `node_6.x`).
## 1 - Create a playbook with nodejs role
~~~
---
- hosts: hostname
become: yes
roles:
- nodejs
~~~
### 2 - Install nodejs prerequisite with ansible
~~~
# ansible-playbook playbook.yml -K --check --diff --limit hostname
~~~

View file

@ -1,2 +1,2 @@
---
nodejs_apt_version: 'node_6.x'
nodejs_apt_version: 'node_9.x'

View file

@ -1,6 +1,4 @@
---
- name: APT https transport is enabled
apt:
name: apt-transport-https
@ -36,3 +34,19 @@
tags:
- packages
- nodejs
- name: Define Nodejs in global configuration
shell: "npm install -g npm"
- name: Ensure owner
file:
path: "/usr/lib/node_modules"
owner: root
group: 'root'
recurse: yes
- name: Ensure access
file:
path: "/usr/lib/node_modules"
mode: 0755
recurse: yes