nodejs: add 3 tasks + install procedure
This commit is contained in:
parent
ed81597b06
commit
cff9900d94
|
@ -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
|
||||
~~~
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
---
|
||||
nodejs_apt_version: 'node_6.x'
|
||||
nodejs_apt_version: 'node_9.x'
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue