From cff9900d94aedc037837dad807588dff5f7747cb Mon Sep 17 00:00:00 2001 From: Bruno TATU Date: Thu, 1 Feb 2018 10:49:17 +0100 Subject: [PATCH] nodejs: add 3 tasks + install procedure --- nodejs/README.md | 16 ++++++++++++++++ nodejs/defaults/main.yml | 2 +- nodejs/tasks/main.yml | 18 ++++++++++++++++-- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/nodejs/README.md b/nodejs/README.md index 8170f4ae..fb0d4b94 100644 --- a/nodejs/README.md +++ b/nodejs/README.md @@ -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 +~~~ diff --git a/nodejs/defaults/main.yml b/nodejs/defaults/main.yml index f51e88aa..b44c418b 100644 --- a/nodejs/defaults/main.yml +++ b/nodejs/defaults/main.yml @@ -1,2 +1,2 @@ --- -nodejs_apt_version: 'node_6.x' +nodejs_apt_version: 'node_9.x' diff --git a/nodejs/tasks/main.yml b/nodejs/tasks/main.yml index dc024cbd..351e1370 100644 --- a/nodejs/tasks/main.yml +++ b/nodejs/tasks/main.yml @@ -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