Installing nodejs using ansible

0 votes
I'm trying to install nodejs using ansible. How should my playbook look like?
Mar 15 in Ansible by Isha
263 views

1 answer to this question.

0 votes

Your role should look something like this:

- name: Node.js - Get script
  get_url:
    url: "http://deb.nodesource.com/setup_6.x"
    dest: "{{ var_node }}/nodejs.sh"

- name: Node.js - Set execution permission to script
  file:
    path: "{{ var_node }}/nodejs.sh"
    mode: "u+x"

- name: Node.js - Execute installation script
  shell: "{{ var_node }}/nodejs.sh"

- name: Node.js - Remove installation script
  file:
    path: "{{ var_node}}/nodejs.sh"
    state: absent

- name: Node.js - Install Node.js
  apt: name={{ item }} state=present update_cache=yes
  with_items:
    - build-essential
    - nodejs

- name: Node.js - Install bower and gulp globally
  npm: name={{ item }} state=present global=yes
  with_items:
    - bower
    - gulp
answered Mar 15 by Hari

Related Questions In Ansible

0 votes
1 answer
0 votes
1 answer

Installing mongodb using ansible

Your mongodb role should look something like this: - ...READ MORE

answered Mar 15 in Ansible by Purva
265 views
0 votes
1 answer

How can I create a new user using ansible ploybook?

You're switching from the root user. Root ...READ MORE

answered Mar 29, 2018 in Ansible by DareDev
• 6,810 points
86 views
0 votes
3 answers
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer

Deploy nginx using Ansible

Follow these steps: Use the following command in ...READ MORE

answered Jan 8 in Ansible by Barbara
29 views
0 votes
2 answers

How do i install Ansible using virtualenv

Adding to @Mohit's answer,  For CentOS and RHEL: sudo ...READ MORE

answered Jan 10 in Ansible by Dikinson
87 views