-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCentOS7x_Install-Demon-checkForTeamUpdates-playbook.yml
104 lines (79 loc) · 3.73 KB
/
CentOS7x_Install-Demon-checkForTeamUpdates-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
---
################################################################################
# description: Installs Demon Robotics checkForTeamUpdates kit on CentOS7x
# usage: ansible-playbook CentOS7x_Install-Demon-checkForTeamUpdates-playbook.yml --extra-vars 'HostOrGroup=YourServerOrGroupNameGoesHere CHECKFORTEAMUPDATES_WEBHOOK=https://hooks.slack.com/services/SomeSecretKeyGoesHere'
# 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 Demon Robotics checkForTeamUpdates kit 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 demon to the OS so checkForTeamUpdates does not run as root
user:
name: demon
comment: "Demon Robotics"
group: wheel
# git - Deploy software (or files) from git checkouts
# REF: http://docs.ansible.com/ansible/git_module.html
######################################################
- name: Git clone demon_checkForTeamUpdates to /opt/demon_checkForTeamUpdates
git:
repo: https://[email protected]/ernestgwilsonii/checkforteamupdates.git
version: "{{demon_checkForTeamUpdates|default ('master')}}"
dest: /opt/demon_checkForTeamUpdates
accept_hostkey: yes
# Use npm to install and manage Node.js packages
# REF: http://docs.ansible.com/ansible/npm_module.html
######################################################
- name: Run npm install in /opt/demon_checkForTeamUpdates
npm:
path=/opt/demon_checkForTeamUpdates
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/demon_checkForTeamUpdates
file:
path: /opt/demon_checkForTeamUpdates
state: directory
owner: demon
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/demon_checkForTeamUpdates.service
- name: Fill in the variables and copy templates/Demon/demon_checkForTeamUpdates.service.j2 to remote /etc/systemd/system/demon_checkForTeamUpdates.service
template:
src: templates/Demon/demon_checkForTeamUpdates.service.j2
dest: /etc/systemd/system/demon_checkForTeamUpdates.service
owner: root
group: wheel
mode: 0644
# raw - Executes a low-down and dirty SSH command
# REF: http://docs.ansible.com/ansible/raw_module.html
######################################################
- name: systemctl daemon-reload
shell: systemctl daemon-reload
# service - Manage services
# REF: http://docs.ansible.com/ansible/service_module.html
##########################################################
- name: Enable and start the demon_checkForTeamUpdates.service
service:
name: demon_checkForTeamUpdates.service
enabled: yes
state: restarted
# Note: Verify demon_checkForTeamUpdates.service via SSH command line:
# systemctl status demon_checkForTeamUpdates.service
# tail -f /var/log/messages | grep demon_checkForTeamUpdates
# cat /etc/systemd/system/demon_checkForTeamUpdates.service