Ansible Role to Install Nodejs on Linux
Posted By : Jatin Gupta | 22-Mar-2018
What is ansible?
Ansible is a powerful IT automation tool that can help you to configure, deploy and orchestrate various machines from one system.
An example is, suppose you have a cluster of 10 web servers, and you want to update a configuration in each of the web servers. Configuring each server manually will take a lot of time, here Ansible comes handy. You can create a playbook in ansible to update the changes and run it on all 10 servers simultaneously.
One can also create Roles in Ansible. Roles are ways of loading vars file, tasks, handlers etc based on a particular directory structure.
To create a role-based directory structure in Ansible
ubuntu@ubuntu:~$ ansible-galaxy init role_name
ANSIBLE ROLE: Node.js
There can be various scenarios where you want to install node on multiple servers. One such case I faced was when I had to configure log.io for logs of applications running on 20 servers. Log.io requires
You can use the same role for installing any version of a node for any specific user.
Let's get started.
To use the role
Requirements :
None
Role Variables :
Available variables are listed below and can be found in vars/main.yml
node_version : "6.9.0"
The
user_name : testuser
The user for whom the name will be installed.
Dependencies :
None
Example Playbook
-
hosts: utilities
roles:
- Jating7413.node
Author Information
This role was created in 2018 by Jatin Gupta
Ansible Galaxy URL: https://galaxy.ansible.com/Jating7413/node/
To download source code of the role: https://github.com/Jating7413/ansible-role-node
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Jatin Gupta
Jatin is a DevOps trainee. He ha deep interest in python and cloud technologies. He likes to read about science/history and fiction, listening to music and explore new places.