-
Notifications
You must be signed in to change notification settings - Fork 1
/
RHEL7x_Install-Chrysus-playbook.yml
93 lines (71 loc) · 2.91 KB
/
RHEL7x_Install-Chrysus-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
---
################################################################################
# description: Installs Chrysus on RHEL7x
# usage: ansible-playbook RHEL7x_Install-Hubot-playbook.yml --extra-vars 'HostOrGroup=YourServerOrGroupNameGoesHere CHRYSUS_REDISPASS=RedisPasswordHere'
# 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 Chrysus 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:
# Create and manage user accounts
# REF: http://docs.ansible.com/ansible/user_module.html
#######################################################
- name: Add user chrysus to the OS so Chrysus does not run as root
user:
name=chrysus
comment="Chrysus"
group=wheel
# 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
##################################################################################
# /opt/chrysus
- name: Create directory /opt/chrysus if it does not exist - mkdir -p /opt/chrysus
file:
path=/opt/chrysus
state=directory
mode=0755
owner=chrysus
group=wheel
recurse=yes
# Use the template module to populate files with data
# REF: http://docs.ansible.com/ansible/template_module.html
###########################################################
# /etc/systemd/system/chatops.service
- name: Fill in the variables and copy templates/Chrysus/chrysus.service.j2 to remote /etc/systemd/system/chrysus.service
template:
src=templates/Chrysus/chrysus.service.j2
dest=/etc/systemd/system/chrysus.service
owner=root
group=wheel
mode=0755
# raw - Executes a low-down and dirty SSH command
# REF: http://docs.ansible.com/ansible/raw_module.html
######################################################
- name: Install Chrysus Engine
shell: cd /opt/chrysus; /usr/bin/npm install chrysus
# Set attributes of files
# REF: http://docs.ansible.com/ansible/file_module.html
#######################################################
- name: Set directory permisions on /opt/chrysus
file:
path=/opt/chrysus
state=directory
owner=chrysus
group=wheel
recurse=yes
# Enable and start the service
# REF: http://docs.ansible.com/ansible/service_module.html
##########################################################
- name: Enable and start the chrysus service
service:
name=chrysus.service
enabled=yes
state=restarted
# Note: Verify chrysus via SSH command line:
# systemctl status chrysus