roles/nodejs/tasks/main.yaml
changeset 15 6913019b9492
parent 14 1d79e73c881f
child 16 23b704e271bb
equal deleted inserted replaced
14:1d79e73c881f 15:6913019b9492
     1 ---
       
     2 
       
     3 # https://github.com/nfarina/homebridge/wiki/Running-HomeBridge-on-a-Raspberry-Pi
       
     4 
       
     5 - name: download and unarchive nodejs
       
     6   become: yes
       
     7   unarchive:
       
     8     src: "https://nodejs.org/dist/v{{nodejs_version}}/{{nodejs_dir}}.tar.xz"
       
     9     dest: "/opt/"
       
    10     remote_src: yes
       
    11     creates: "/opt/{{nodejs_dir}}"
       
    12 
       
    13 # sudo update-alternatives --install "/usr/bin/node" "node" "/opt/node/bin/node" 1
       
    14 - name: update node alterantives
       
    15   become: yes
       
    16   alternatives:
       
    17     link: "/usr/bin/{{item}}"
       
    18     name: "{{item}}"
       
    19     path: "/opt/{{nodejs_dir}}/bin/{{item}}"
       
    20     priority: "1"
       
    21   with_items:
       
    22     - "node"
       
    23     - "npm"
       
    24 
       
    25 - name: npm install global deps
       
    26   become: yes
       
    27   npm: name="{{item}}" global="yes"
       
    28   with_items:
       
    29     - "npm"
       
    30     - "node-gyp"
       
    31 
       
    32 - name: update node-gyp alterantives
       
    33   become: yes
       
    34   alternatives:
       
    35     link: "/usr/bin/node-gyp"
       
    36     name: "node-gyp"
       
    37     path: "/opt/{{nodejs_dir}}/bin/node-gyp"
       
    38     priority: "1"