nodejs/tasks/main.yaml
changeset 2 2556522a2a45
parent 0 df042396074e
child 12 80a6e9af6aa9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nodejs/tasks/main.yaml	Sun Feb 09 12:05:37 2020 -0600
@@ -0,0 +1,21 @@
+---
+
+- name: download and unarchive nodejs
+  become: yes
+  unarchive:
+    src: "https://nodejs.org/dist/{{nodejs_tag}}/{{nodejs_dir}}.tar.xz"
+    dest: "/opt/"
+    remote_src: yes
+    creates: "/opt/{{nodejs_dir}}"
+
+# sudo update-alternatives --install "/usr/bin/node" "node" "/opt/node/bin/node" 1
+- name: update node alterantives
+  become: yes
+  alternatives:
+    link: "/usr/bin/{{item}}"
+    name: "{{item}}"
+    path: "/opt/{{nodejs_dir}}/bin/{{item}}"
+    priority: "1"
+  with_items:
+    - "node"
+    - "npm"