-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCentOS7x_Apply-Updates-Demon-checkForTeamUpdates-playbook.yml
99 lines (73 loc) · 3.4 KB
/
CentOS7x_Apply-Updates-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
---
################################################################################
# description: Apply updates to Demon Robotic's checkForTeamUpdates on CentOS7x
# usage: ansible-playbook CentOS7x_Apply-Updates-Demon-checkForTeamUpdates-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: Apply updates to Demon Robotic's checkForTeamUpdates 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:
# Stop service
# REF: http://docs.ansible.com/ansible/service_module.html
##########################################################
- name: Stop the demon_checkForTeamUpdates.service service
service:
name: demon_checkForTeamUpdates.service
state: stopped
# file - Sets attributes of files and folders
# REF: http://docs.ansible.com/ansible/file_module.html
##################################################################################
- name: rm -rf /opt/demon_checkForTeamUpdates.old if it exists!
file:
path: /opt/demon_checkForTeamUpdates.old
state: absent
# command - Executes a command on a remote node
# REF: http://docs.ansible.com/ansible/command_module.html
##########################################################
- name: Rename the existing demon_checkForTeamUpdates to create a fallback backup in demon_checkForTeamUpdates.old
command: mv -f /opt/demon_checkForTeamUpdates /opt/demon_checkForTeamUpdates.old
# git - Deploy software (or files) from git checkouts
# REF: http://docs.ansible.com/ansible/git_module.html
######################################################
- name: Update (git clone) demon_checkForTeamUpdates to /opt/demon_checkForTeamUpdates
git:
repo: https://[email protected]/ernestgwilsonii/checkforteamupdates.git
version: master
dest: /opt/demon_checkForTeamUpdates
accept_hostkey: yes
update: yes
# Use npm to install and manage Node.js packages
# REF: http://docs.ansible.com/ansible/npm_module.html
######################################################
- name: Run npm install in 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 demon_checkForTeamUpdates
file:
path: /opt/demon_checkForTeamUpdates
state: directory
owner: demon
group: wheel
recurse: yes
# Enable and start the service
# REF: http://docs.ansible.com/ansible/service_module.html
##########################################################
- name: Restart the demon_checkForTeamUpdates service
service:
name: demon_checkForTeamUpdates.service
state: restarted
# Note: Verify demon_checkForTeamUpdates via SSH command line:
# systemctl status demon_checkForTeamUpdates
# tail -f /var/log/messages | grep demon_checkForTeamUpdates