Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
configuration
Commits
bb50bb7a
Commit
bb50bb7a
authored
Aug 10, 2016
by
Bilal Ahmad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
addressing comments
parent
c9b01e68
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
27 deletions
+26
-27
playbooks/roles/common/tasks/main.yml
+22
-0
playbooks/roles/common/templates/etc/logrotate.d/ntp.j2
+1
-1
playbooks/roles/common/templates/log-ntp-alerts.sh.j2
+3
-3
playbooks/roles/ecommerce/defaults/main.yml
+0
-1
playbooks/roles/ecommerce/tasks/main.yml
+0
-22
No files found.
playbooks/roles/common/tasks/main.yml
View file @
bb50bb7a
...
@@ -158,3 +158,25 @@
...
@@ -158,3 +158,25 @@
state
:
restarted
state
:
restarted
become
:
True
become
:
True
when
:
config_templates.changed
when
:
config_templates.changed
-
name
:
Add ntp alert script
template
:
src
:
"
log-ntp-alerts.sh.j2"
dest
:
"
{{
COMMON_BIN_DIR
}}/log-ntp-alerts.sh"
owner
:
root
group
:
root
mode
:
"
0755"
-
name
:
Set up a cron job to run the script
cron
:
name
:
"
log-ntp-alerts"
job
:
"
{{
COMMON_BIN_DIR
}}/log-ntp-alerts.sh
>/dev/null
2>&1"
-
name
:
install logrotate configuration
template
:
src
:
etc/logrotate.d/ntp.j2
dest
:
/etc/logrotate.d/ntp
tags
:
-
"
install"
-
"
install:configuration"
-
"
logrotate"
playbooks/roles/
ecommerce/templates/etc/logrotate.d/ecommerce
.j2
→
playbooks/roles/
common/templates/etc/logrotate.d/ntp
.j2
View file @
bb50bb7a
{{
ecommerce_log_dir }}/*
.log {
{{
COMMON_LOG_DIR }}/ntp
.log {
compress
compress
dateext
dateext
dateformat -%Y%m%d-%s
dateformat -%Y%m%d-%s
...
...
playbooks/roles/
ecommerce/templates/edx/app/ecommerce
/log-ntp-alerts.sh.j2
→
playbooks/roles/
common/templates
/log-ntp-alerts.sh.j2
View file @
bb50bb7a
#!/bin/bash
#!/bin/bash
log_directory
={{
ecommerce_log_dir
}}
log_directory
={{
COMMON_LOG_DIR
}}
reach
=
$(
ntpq
-c
associations | awk
'{print $5}'
|
grep
yes
)
reach
=
$(
ntpq
-c
associations | awk
'{print $5}'
|
grep
yes
)
if
[[
${
reach
}
==
*
"no"
*
]]
;
then
if
[[
${
reach
}
==
*
"no"
*
]]
;
then
echo
"NTPD not synchronized - Please investigate"
>>
${
log_directory
}
/ntp.log
echo
$(
date
-u
)
"NTPD not synchronized - Please investigate"
>>
${
log_directory
}
/ntp.log
fi
fi
limit
=
100
# limit in milliseconds
limit
=
100
# limit in milliseconds
offsets
=
$(
ntpq
-nc
peers | tail
-n
+3 | cut
-c
62-66 | tr
-d
'-'
)
offsets
=
$(
ntpq
-nc
peers | tail
-n
+3 | cut
-c
62-66 | tr
-d
'-'
)
for
offset
in
${
offsets
}
;
do
for
offset
in
${
offsets
}
;
do
if
[
${
offset
:-
0
}
-ge
${
limit
:-
100
}
]
;
then
if
[
${
offset
:-
0
}
-ge
${
limit
:-
100
}
]
;
then
echo
"An NTPD offset is excessive - Please investigate"
>>
${
log_directory
}
/ntp.log
echo
$(
date
-u
)
"An NTPD offset is excessive - Please investigate"
>>
${
log_directory
}
/ntp.log
exit
1
exit
1
fi
fi
done
done
playbooks/roles/ecommerce/defaults/main.yml
View file @
bb50bb7a
...
@@ -204,7 +204,6 @@ ECOMMERCE_GUNICORN_WORKER_CLASS: "gevent"
...
@@ -204,7 +204,6 @@ ECOMMERCE_GUNICORN_WORKER_CLASS: "gevent"
#
#
ecommerce_service_name
:
"
ecommerce"
ecommerce_service_name
:
"
ecommerce"
ecommerce_user
:
"
{{
ecommerce_service_name
}}"
ecommerce_user
:
"
{{
ecommerce_service_name
}}"
ecommerce_group
:
"
{{
ecommerce_service_name
}}"
ecommerce_home
:
"
{{
COMMON_APP_DIR
}}/{{
ecommerce_service_name
}}"
ecommerce_home
:
"
{{
COMMON_APP_DIR
}}/{{
ecommerce_service_name
}}"
ecommerce_code_dir
:
"
{{
ecommerce_home
}}/{{
ecommerce_service_name
}}"
ecommerce_code_dir
:
"
{{
ecommerce_home
}}/{{
ecommerce_service_name
}}"
ecommerce_venv_dir
:
"
{{
ecommerce_home
}}/venvs/{{
ecommerce_service_name
}}"
ecommerce_venv_dir
:
"
{{
ecommerce_home
}}/venvs/{{
ecommerce_service_name
}}"
...
...
playbooks/roles/ecommerce/tasks/main.yml
View file @
bb50bb7a
...
@@ -226,25 +226,3 @@
...
@@ -226,25 +226,3 @@
tags
:
tags
:
-
manage
-
manage
-
manage:start
-
manage:start
-
name
:
Add ntp alert script
template
:
src
:
"
edx/app/ecommerce/log-ntp-alerts.sh.j2"
dest
:
"
{{
ecommerce_home
}}/log-ntp-alerts.sh"
owner
:
"
{{
ecommerce_user
}}"
group
:
"
{{
ecommerce_group
}}"
mode
:
"
0755"
-
name
:
Set up a cron job to run the script
cron
:
name
:
"
log-ntp-alerts"
job
:
"
{{
ecommerce_home
}}/log-ntp-alerts.sh
>/dev/null
2>&1"
-
name
:
install logrotate configuration
template
:
src
:
etc/logrotate.d/ecommerce.j2
dest
:
/etc/logrotate.d/ecommerce
tags
:
-
"
install"
-
"
install:configuration"
-
"
logrotate"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment