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
701a61c2
Commit
701a61c2
authored
Jun 21, 2016
by
arbabnazar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rewrite the tasks using YAML syntax
parent
1ab59651
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
124 additions
and
106 deletions
+124
-106
playbooks/roles/xqwatcher/tasks/code_jail.yml
+56
-49
playbooks/roles/xqwatcher/tasks/deploy.yml
+14
-10
playbooks/roles/xqwatcher/tasks/deploy_courses.yml
+7
-6
playbooks/roles/xqwatcher/tasks/deploy_watcher.yml
+32
-28
playbooks/roles/xqwatcher/tasks/main.yml
+15
-13
No files found.
playbooks/roles/xqwatcher/tasks/code_jail.yml
View file @
701a61c2
...
@@ -3,91 +3,98 @@
...
@@ -3,91 +3,98 @@
# Tasks related to deploying the code jail for the XQWatcher
# Tasks related to deploying the code jail for the XQWatcher
#
#
-
name
:
Create sandboxed user
-
name
:
Create sandboxed user
user
:
>
user
:
name
=
"{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.user }}"
name
:
"
{{
item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.user
}}"
shell
=
/bin/false
shell
:
/bin/false
home
=
"/dev/null"
home
:
"
/dev/null"
with_items
:
XQWATCHER_COURSES
with_items
:
"
{{
XQWATCHER_COURSES
}}"
tags
:
tags
:
-
install
-
install
-
install:base
-
install:base
#
#
# Need to disable aa to update the virutalenv
# Need to disable apparmor to update the virutalenv
-
name
:
write out apparmor config
-
name
:
Write out apparmor config
template
:
>
template
:
src=etc/apparmor.d/code.jail.j2
src
:
"
etc/apparmor.d/code.jail.j2"
dest="/etc/apparmor.d/code.jail.{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}"
dest
:
"
/etc/apparmor.d/code.jail.{{
item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name
}}"
mode=0644 owner=root group=root
owner
:
root
with_items
:
XQWATCHER_COURSES
group
:
root
mode
:
"
0644"
with_items
:
"
{{
XQWATCHER_COURSES
}}"
tags
:
tags
:
-
install
-
install
-
install:configuration
-
install:configuration
-
name
:
write out sudoers for watcher
-
name
:
Write out sudoers for watcher
template
:
>
template
:
src=etc/sudoers.d/95-xqwatcher.j2
src
:
"
etc/sudoers.d/95-xqwatcher.j2"
dest=/etc/sudoers.d/95-xqwatcher-{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.user|replace('.', '') }}
dest
:
"
/etc/sudoers.d/95-xqwatcher-{{
item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.user|replace('.',
'')
}}"
mode=0440 owner=root group=root validate='visudo -c -f %s'
owner
:
root
with_items
:
XQWATCHER_COURSES
group
:
root
mode
:
"
0440"
validate
:
'
visudo
-c
-f
%s'
with_items
:
"
{{
XQWATCHER_COURSES
}}"
tags
:
tags
:
-
install
-
install
-
install:configuration
-
install:configuration
# see comment below as to why this is skipped.
# see comment below as to why this is skipped.
-
name
:
p
ut code jail into aa-complain
-
name
:
P
ut code jail into aa-complain
command
:
/usr/sbin/aa-complain "/etc/apparmor.d/code.jail.{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}"
command
:
/usr/sbin/aa-complain "/etc/apparmor.d/code.jail.{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}"
with_items
:
XQWATCHER_COURSES
with_items
:
"
{{
XQWATCHER_COURSES
}}"
tags
:
tags
:
-
manage
-
manage
-
manage:sandbox
-
manage:sandbox
-
name
:
create jail virtualenv
-
name
:
Create jail virtualenv
shell
:
>
shell
:
"
/usr/local/bin/virtualenv
--no-site-packages
{{
xqwatcher_app_dir
}}/venvs/{{
item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name
}}"
/usr/local/bin/virtualenv --no-site-packages {{ xqwatcher_app_dir }}/venvs/{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}
with_items
:
"
{{
XQWATCHER_COURSES
}}"
with_items
:
XQWATCHER_COURSES
tags
:
tags
:
-
install
-
install
-
install:code
-
install:code
-
name
:
write out requirements.txt
-
name
:
Write out requirements.txt
template
:
>
template
:
src=edx/app/xqwatcher/data/requirements.txt.j2
src
:
"
edx/app/xqwatcher/data/requirements.txt.j2"
dest={{ xqwatcher_app_dir }}/data/{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}-requirements.txt
dest
:
"
{{
xqwatcher_app_dir
}}/data/{{
item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name
}}-requirements.txt"
mode=0440 owner=root group=root
owner
:
root
with_items
:
XQWATCHER_COURSES
group
:
root
mode
:
"
0440"
with_items
:
"
{{
XQWATCHER_COURSES
}}"
tags
:
tags
:
-
install
-
install
-
install:code
-
install:code
-
name
:
i
nstall course specific python requirements
-
name
:
I
nstall course specific python requirements
pip
:
>
pip
:
requirements
=
"{{ xqwatcher_app_data }}/{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}-requirements.txt"
requirements
:
"
{{
xqwatcher_app_data
}}/{{
item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name
}}-requirements.txt"
virtualenv
=
"{{ xqwatcher_app_dir }}/venvs/{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}"
virtualenv
:
"
{{
xqwatcher_app_dir
}}/venvs/{{
item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name
}}"
state
=
present
state
:
present
extra_args
=
"{{ XQWATCHER_PIP_EXTRA_ARGS }}"
extra_args
:
"
{{
XQWATCHER_PIP_EXTRA_ARGS
}}"
with_items
:
XQWATCHER_COURSES
with_items
:
"
{{
XQWATCHER_COURSES
}}"
tags
:
tags
:
-
install
-
install
-
install:code
-
install:code
-
name
:
give other read permissions to the virtualenv
-
name
:
Give other read permissions to the virtualenv
shell
:
>
shell
:
"
chown
-R
{{
item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.user
}}
{{
xqwatcher_app_dir
}}/venvs/{{
item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name
}}"
chown -R {{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.user }} {{ xqwatcher_app_dir }}/venvs/{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}
with_items
:
"
{{
XQWATCHER_COURSES
}}"
with_items
:
XQWATCHER_COURSES
tags
:
tags
:
-
install
-
install
-
install:code
-
install:code
-
name
:
start apparmor service
-
name
:
Start apparmor service
service
:
name=apparmor state=started
service
:
name
:
apparmor
state
:
started
tags
:
tags
:
-
manage
-
manage
-
manage:sandbox
-
manage:sandbox
-
name
:
l
oad code sandbox profile
-
name
:
L
oad code sandbox profile
command
:
apparmor_parser -r "/etc/apparmor.d/code.jail.{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}"
command
:
apparmor_parser -r "/etc/apparmor.d/code.jail.{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}"
with_items
:
XQWATCHER_COURSES
with_items
:
"
{{
XQWATCHER_COURSES
}}"
tags
:
tags
:
-
manage
-
manage
-
manage:sandbox
-
manage:sandbox
...
@@ -96,20 +103,20 @@
...
@@ -96,20 +103,20 @@
# Leaves aa in either complain or enforce depending upon the value of the
# Leaves aa in either complain or enforce depending upon the value of the
# CODE_JAIL_COMPLAIN var. Complain mode should never be run in an
# CODE_JAIL_COMPLAIN var. Complain mode should never be run in an
# environment where untrusted users can submit code
# environment where untrusted users can submit code
-
name
:
p
ut code jail into aa-complain
-
name
:
P
ut code jail into aa-complain
command
:
/usr/sbin/aa-complain "/etc/apparmor.d/code.jail.{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}"
command
:
/usr/sbin/aa-complain "/etc/apparmor.d/code.jail.{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}"
when
:
CODE_JAIL_COMPLAIN|bool
when
:
CODE_JAIL_COMPLAIN|bool
with_items
:
XQWATCHER_COURSES
with_items
:
"
{{
XQWATCHER_COURSES
}}"
# AA having issues on 14.04
# AA having issues on 14.04
# https://github.com/edx/codejail/issues/38
# https://github.com/edx/codejail/issues/38
tags
:
tags
:
-
manage
-
manage
-
manage:sandbox
-
manage:sandbox
-
name
:
p
ut code sandbox into aa-enforce
-
name
:
P
ut code sandbox into aa-enforce
command
:
/usr/sbin/aa-enforce "/etc/apparmor.d/code.jail.{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}"
command
:
/usr/sbin/aa-enforce "/etc/apparmor.d/code.jail.{{ item.QUEUE_CONFIG.HANDLERS[0].CODEJAIL.name }}"
when
:
not CODE_JAIL_COMPLAIN|bool
when
:
not CODE_JAIL_COMPLAIN|bool
with_items
:
XQWATCHER_COURSES
with_items
:
"
{{
XQWATCHER_COURSES
}}"
tags
:
tags
:
-
manage
-
manage
-
manage:sandbox
-
manage:sandbox
playbooks/roles/xqwatcher/tasks/deploy.yml
View file @
701a61c2
-
name
:
install courses ssh key
-
name
:
Install courses ssh key
copy
:
>
copy
:
content="{{ XQWATCHER_GIT_IDENTITY }}"
content
:
"
{{
XQWATCHER_GIT_IDENTITY
}}"
dest={{ xqwatcher_app_dir }}/.ssh/{{ xqwatcher_service_name }}-courses
dest
:
"
{{
xqwatcher_app_dir
}}/.ssh/{{
xqwatcher_service_name
}}-courses"
owner={{ xqwatcher_user }} group={{ xqwatcher_user }} mode=0600
owner
:
"
{{
xqwatcher_user
}}"
group
:
"
{{
xqwatcher_user
}}"
mode
:
"
0600"
tags
:
tags
:
-
install
-
install
-
install:code
-
install:code
#TODO: remove once xqwatcher.json can be pulled out into /edx/etc/
#TODO: remove once xqwatcher.json can be pulled out into /edx/etc/
-
name
:
write out watcher config file
-
name
:
Write out watcher config file
template
:
>
template
:
src=edx/app/xqwatcher/xqwatcher.json.j2
src
:
"
edx/app/xqwatcher/xqwatcher.json.j2"
dest={{ xqwatcher_conf_dir }}/xqwatcher.json
dest
:
"
{{
xqwatcher_conf_dir
}}/xqwatcher.json"
mode=0644 owner={{ xqwatcher_user }} group={{ xqwatcher_user }}
owner
:
"
{{
xqwatcher_user
}}"
group
:
"
{{
xqwatcher_user
}}"
mode
:
"
0644"
tags
:
tags
:
-
install
-
install
-
install:configuration
-
install:configuration
...
...
playbooks/roles/xqwatcher/tasks/deploy_courses.yml
View file @
701a61c2
...
@@ -2,12 +2,13 @@
...
@@ -2,12 +2,13 @@
# checking out the grader code from the repository specified on
# checking out the grader code from the repository specified on
# a per queue basis.
# a per queue basis.
-
name
:
checkout grader code
-
name
:
Checkout grader code
git_2_0_1
:
>
git_2_0_1
:
dest={{ xqwatcher_app_dir }}/data/{{ item.COURSE }} repo={{ item.GIT_REPO }}
repo
:
"
{{
item.GIT_REPO
}}"
version={{ item.GIT_REF }}
dest
:
"
{{
xqwatcher_app_dir
}}/data/{{
item.COURSE
}}"
ssh_opts="{{ xqwatcher_course_git_ssh_opts }}"
version
:
"
{{
item.GIT_REF
}}"
with_items
:
XQWATCHER_COURSES
ssh_opts
:
"
{{
xqwatcher_course_git_ssh_opts
}}"
with_items
:
"
{{
XQWATCHER_COURSES
}}"
tags
:
tags
:
-
install
-
install
-
install:code
-
install:code
playbooks/roles/xqwatcher/tasks/deploy_watcher.yml
View file @
701a61c2
...
@@ -2,59 +2,63 @@
...
@@ -2,59 +2,63 @@
# The watcher can watch one or many queues and dispatch submissions
# The watcher can watch one or many queues and dispatch submissions
# to the appropriate grader which lives in a separate SCM repository.
# to the appropriate grader which lives in a separate SCM repository.
-
name
:
install application requirements
-
name
:
Install application requirements
pip
:
>
pip
:
requirements="{{ xqwatcher_requirements_file }}"
requirements
:
"
{{
xqwatcher_requirements_file
}}"
virtualenv="{{ xqwatcher_app_dir }}/venvs/{{ xqwatcher_service_name }}" state=present
virtualenv
:
"
{{
xqwatcher_app_dir
}}/venvs/{{
xqwatcher_service_name
}}"
state
:
present
become
:
true
become
:
true
become_user
:
"
{{
xqwatcher_user
}}"
become_user
:
"
{{
xqwatcher_user
}}"
tags
:
tags
:
-
install
-
install
-
install:app-requirements
-
install:app-requirements
-
name
:
write out course config files
-
name
:
Write out course config files
template
:
>
template
:
src=edx/app/xqwatcher/conf.d/course.json.j2
src
:
"
edx/app/xqwatcher/conf.d/course.json.j2"
dest={{ xqwatcher_conf_dir }}/conf.d/{{ item.COURSE }}.json
dest
:
"
{{
xqwatcher_conf_dir
}}/conf.d/{{
item.COURSE
}}.json"
mode=0644 owner={{ xqwatcher_user }} group={{ xqwatcher_user }}
owner
:
"
{{
xqwatcher_user
}}"
with_items
:
XQWATCHER_COURSES
group
:
"
{{
xqwatcher_user
}}"
mode
:
"
0644"
with_items
:
"
{{
XQWATCHER_COURSES
}}"
tags
:
tags
:
-
install
-
install
-
install:configuration
-
install:configuration
-
name
:
write supervisord config
-
name
:
Write supervisord config
template
:
>
template
:
src=edx/app/supervisor/conf.d/xqwatcher.conf.j2
src
:
"
edx/app/supervisor/conf.d/xqwatcher.conf.j2"
dest="{{ xqwatcher_supervisor_available_dir }}/xqwatcher.conf"
dest
:
"
{{
xqwatcher_supervisor_available_dir
}}/xqwatcher.conf"
group={{ xqwatcher_user }} mode=0650
group
:
"
{{
xqwatcher_user
}}"
mode
:
"
0650"
tags
:
tags
:
-
install
-
install
-
install:configuration
-
install:configuration
-
name
:
e
nable supervisor script
-
name
:
E
nable supervisor script
file
:
>
file
:
src
={{ xqwatcher_supervisor_available_dir }}/xqwatcher.conf
src
:
"
{{
xqwatcher_supervisor_available_dir
}}/xqwatcher.conf"
dest
={{ xqwatcher_supervisor_cfg_dir }}/xqwatcher.conf
dest
:
"
{{
xqwatcher_supervisor_cfg_dir
}}/xqwatcher.conf"
state
=
link
state
:
link
force
=
yes
force
:
yes
when
:
not disable_edx_services
when
:
not disable_edx_services
tags
:
tags
:
-
install
-
install
-
install:configuration
-
install:configuration
-
name
:
u
pdate supervisor configuration
-
name
:
U
pdate supervisor configuration
shell
:
"
{{
xqwatcher_supervisor_ctl
}}
-c
{{
xqwatcher_supervisor_app_dir
}}/supervisord.conf
update"
shell
:
"
{{
xqwatcher_supervisor_ctl
}}
-c
{{
xqwatcher_supervisor_app_dir
}}/supervisord.conf
update"
when
:
not disable_edx_services
when
:
not disable_edx_services
tags
:
tags
:
-
manage
-
manage
-
manage:update
-
manage:update
-
name
:
r
estart xqwatcher
-
name
:
R
estart xqwatcher
supervisorctl
:
>
supervisorctl
:
state=restarted
name
:
"
{{
xqwatcher_service_name
}}"
supervisorctl_path
={{ xqwatcher_supervisor_ctl }}
supervisorctl_path
:
"
{{
xqwatcher_supervisor_ctl
}}"
config
={{ xqwatcher_supervisor_app_dir }}/supervisord.conf
config
:
"
{{
xqwatcher_supervisor_app_dir
}}/supervisord.conf"
name={{ xqwatcher_service_name }}
state
:
restarted
when
:
not disable_edx_services
when
:
not disable_edx_services
become_user
:
"
{{
xqwatcher_user
}}"
become_user
:
"
{{
xqwatcher_user
}}"
tags
:
tags
:
...
...
playbooks/roles/xqwatcher/tasks/main.yml
View file @
701a61c2
...
@@ -86,26 +86,28 @@
...
@@ -86,26 +86,28 @@
# -----END RSA PRIVATE KEY-----
# -----END RSA PRIVATE KEY-----
#
#
-
name
:
c
reate conf dir
-
name
:
C
reate conf dir
file
:
>
file
:
path
=
"{{ xqwatcher_conf_dir }}"
path
:
"
{{
xqwatcher_conf_dir
}}"
state
=
directory
state
:
directory
owner
=
"{{ xqwatcher_user }}"
owner
:
"
{{
xqwatcher_user
}}"
group
=
"{{ xqwatcher_user }}"
group
:
"
{{
xqwatcher_user
}}"
tags
:
tags
:
-
install
-
install
-
install:base
-
install:base
-
name
:
c
reate conf.d dir
-
name
:
C
reate conf.d dir
file
:
>
file
:
path
=
"{{ xqwatcher_conf_dir }}/conf.d"
path
:
"
{{
xqwatcher_conf_dir
}}/conf.d"
state
=
directory
state
:
directory
owner
=
"{{ xqwatcher_user }}"
owner
:
"
{{
xqwatcher_user
}}"
group
=
"{{ xqwatcher_user }}"
group
:
"
{{
xqwatcher_user
}}"
tags
:
tags
:
-
install
-
install
-
install:base
-
install:base
-
include
:
code_jail.yml CODE_JAIL_COMPLAIN=false
-
include
:
code_jail.yml CODE_JAIL_COMPLAIN=false
-
include
:
deploy.yml tags=deploy
-
include
:
deploy.yml
tags
:
-
deploy
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