-
Notifications
You must be signed in to change notification settings - Fork 1
/
RHEL7x_Install-NodeJS-playbook.yml
98 lines (72 loc) · 2.81 KB
/
RHEL7x_Install-NodeJS-playbook.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
---
################################################################################
# description: Installs NodeJS on RHEL7x
# usage: ansible-playbook RHEL7x_Install-NodeJS-playbook.yml --extra-vars 'HostOrGroup=YourServerOrGroupNameGoesHere'
# author: Ernest G. Wilson II <[email protected]> (https://github.com/ernestgwilsonii)
# license: MIT
################################################################################
# Ansible Playbook options
# REF: http://docs.ansible.com/ansible/playbooks.html
#####################################################
- name: Install NodeJS on RHEL7x
hosts: "{{ HostOrGroup|default ('FATAL ERROR --> HostOrGroup NOT SET! You must specify either a Host or a Group name!') }}"
serial: "100%"
gather_facts: False
tasks:
# Execute raw command(s)
# REF: http://docs.ansible.com/ansible/raw_module.html
##########################################################
- name: Install the nodesource/x86_64 repository for Node.js
raw: curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -
# REF: https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora
# Install yum packages (listed in alphabetical order)
# REF: http://docs.ansible.com/ansible/yum_module.html
######################################################
- name: Install gcc
yum:
name=gcc
state=latest
- name: Install gcc-c++
yum:
name=gcc-c++
state=latest
- name: Install make
yum:
name=make
state=latest
- name: Install nodejs
yum:
name=nodejs
state=latest
# REF: https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora
- name: Install redis
yum:
name=redis
state=latest
# Execute raw command(s)
# REF: http://docs.ansible.com/ansible/raw_module.html
##########################################################
- name: Update npm globally
raw: /usr/bin/npm install npm -g
- name: Install coffee globally
raw: /usr/bin/npm install coffee -g
- name: Install coffee-script globally
raw: /usr/bin/npm install coffee-script -g
- name: Install generator-hubot globally
raw: /usr/bin/npm install generator-hubot -g
# Use the file module to create a directory and symbolic links if they don't exist
# REF: http://docs.ansible.com/ansible/file_module.html
##################################################################################
- name: Create directory directory if it does not exist - mkdir -p /opt
file:
path=/opt
state=directory
mode=0755
# Start redis.service
# REF: http://docs.ansible.com/ansible/service_module.html
##########################################################
- name: Ensure the redis.service service is enabled and started
service:
name=redis.service
enabled=yes
state=restarted