-
Notifications
You must be signed in to change notification settings - Fork 1
/
CentOS7x_Install-Chrysus-playbook.yml
107 lines (82 loc) · 3.26 KB
/
CentOS7x_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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
---
################################################################################
# description: Installs Chrysus on CentOS7x
# usage: ansible-playbook CentOS7x_Install-Chrysus-playbook.yml --extra-vars 'HostOrGroup=YourServerOrGroupNameGoesHere CHRYSUS_REDISPASS=RedisPasswordHere'
# author: Ernest G. Wilson II <ErnestGWilsonII@gmail.com> (https://github.com/ernestgwilsonii)
# license: MIT
################################################################################
# Ansible Playbook options
# REF: http://docs.ansible.com/ansible/playbooks.html
#####################################################
- name: Install Chrysus on CentOS7x
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
# git - Deploy software (or files) from git checkouts
# REF: http://docs.ansible.com/ansible/git_module.html
######################################################
- name: Git clone Chrysus to /opt/chrysus
git:
repo: https://github.com/chrysus-io/chrysus.git
dest: /opt/chrysus
# Use npm to install and manage Node.js packages
# REF: http://docs.ansible.com/ansible/npm_module.html
######################################################
- name: Run npm install in /opt/chrysus
npm:
path: /opt/chrysus
state: latest
production: yes
global: no
# 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