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
92acf889
Commit
92acf889
authored
Jun 22, 2016
by
Arbab Nazar
Committed by
GitHub
Jun 22, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3145 from edx/arbab/xqueue-rewrite
use YAML syntax to write ansible tasks
parents
e9ad371e
db8625ee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
99 deletions
+97
-99
playbooks/roles/xqueue/tasks/deploy.yml
+76
-79
playbooks/roles/xqueue/tasks/main.yml
+21
-20
No files found.
playbooks/roles/xqueue/tasks/deploy.yml
View file @
92acf889
-
name
:
"
writing
supervisor
scripts
-
xqueue,
xqueue
consumer"
template
:
>
src={{ item }}.conf.j2 dest={{ supervisor_available_dir }}/{{ item }}.conf
owner={{ supervisor_user }} group={{ common_web_user }} mode=0644
with_items
:
[
'
xqueue'
,
'
xqueue_consumer'
]
---
-
name
:
"
Writing
supervisor
scripts
-
xqueue,
xqueue
consumer"
template
:
src
:
"
{{
item
}}.conf.j2"
dest
:
"
{{
supervisor_available_dir
}}/{{
item
}}.conf"
owner
:
"
{{
supervisor_user
}}"
group
:
"
{{
common_web_user
}}"
mode
:
"
0644"
with_items
:
-
xqueue
-
xqueue_consumer
tags
:
-
install
-
install:configuration
-
name
:
"
enabling
supervisor
scripts
-
xqueue,
xqueue
consumer"
file
:
>
src={{ supervisor_available_dir }}/{{ item }}.conf
dest={{ supervisor_cfg_dir }}/{{ item }}.conf
owner={{ supervisor_user }} group={{ common_web_user }}
mode=0644 state=link force=yes
with_items
:
[
'
xqueue'
,
'
xqueue_consumer'
]
-
name
:
"
Enabling
supervisor
scripts
-
xqueue,
xqueue
consumer"
file
:
src
:
"
{{
supervisor_available_dir
}}/{{
item
}}.conf"
dest
:
"
{{
supervisor_cfg_dir
}}/{{
item
}}.conf"
owner
:
"
{{
supervisor_user
}}"
group
:
"
{{
common_web_user
}}"
mode
:
"
0644"
state
:
link
force
:
yes
with_items
:
-
xqueue
-
xqueue_consumer
when
:
not disable_edx_services
tags
:
-
install
-
install:configuration
-
name
:
"
add
gunicorn
configuration
file"
template
:
>
src=xqueue_gunicorn.py.j2 dest={{ xqueue_app_dir }}/xqueue_gunicorn.py
become_user
:
"
{{
xqueue_user
}}"
tags
:
-
install
-
install:configuration
-
name
:
create xqueue application config
template
:
src=xqueue.env.json.j2 dest={{ xqueue_app_dir }}/xqueue.env.json mode=0644
become_user
:
"
{{
xqueue_user
}}"
tags
:
-
install
-
install:configuration
-
name
:
create xqueue auth file
template
:
src=xqueue.auth.json.j2 dest={{ xqueue_app_dir }}/xqueue.auth.json mode=0644
-
name
:
Copy the configurations to the desired directory
template
:
src
:
"
{{
item.src
}}"
dest
:
"
{{
xqueue_app_dir
}}/{{
item.dest
}}"
mode
:
"
{{
item.mode
}}"
become_user
:
"
{{
xqueue_user
}}"
with_items
:
-
{
src
:
'
xqueue_gunicorn.py.j2'
,
dest
:
'
xqueue_gunicorn.py'
,
mode
:
'
0644'
}
-
{
src
:
'
xqueue.env.json.j2'
,
dest
:
'
xqueue.env.json'
,
mode
:
'
0644'
}
-
{
src
:
'
xqueue.auth.json.j2'
,
dest
:
'
xqueue.auth.json'
,
mode
:
'
0644'
}
tags
:
-
install
-
install:configuration
# Do A Checkout
-
name
:
git checkout xqueue repo into xqueue_code_dir
git_2_0_1
:
>
dest={{ xqueue_code_dir }} repo={{ xqueue_source_repo }} version={{ xqueue_version }}
accept_hostkey=yes
-
name
:
"
Git
checkout
xqueue
repo
into
{{
xqueue_code_dir
}}"
git_2_0_1
:
repo
:
"
{{
xqueue_source_repo
}}"
dest
:
"
{{
xqueue_code_dir
}}"
version
:
"
{{
xqueue_version
}}"
accept_hostkey
:
yes
become_user
:
"
{{
xqueue_user
}}"
register
:
xqueue_checkout
tags
:
-
install
-
install:code
# Install the python pre requirements into {{ xqueue_venv_dir }}
-
name
:
install python pre-requirements
pip
:
>
requirements="{{ xqueue_pre_requirements_file }}" virtualenv="{{ xqueue_venv_dir }}" state=present
extra_args="-i {{ COMMON_PYPI_MIRROR_URL }} --exists-action w"
become_user
:
"
{{
xqueue_user
}}"
tags
:
-
install
-
install:app-requirements
# Install the python post requirements into {{ xqueue_venv_dir }}
-
name
:
install python post-requirements
pip
:
>
requirements="{{ xqueue_post_requirements_file }}" virtualenv="{{ xqueue_venv_dir }}" state=present
extra_args="-i {{ COMMON_PYPI_MIRROR_URL }} --exists-action w"
# Install the python pre requirements and post requirements into {{ xqueue_venv_dir }}
-
name
:
"
Install
python
pre-requirements
and
post-requirements"
pip
:
requirements
:
"
{{
item
}}"
virtualenv
:
"
{{
xqueue_venv_dir
}}"
state
:
present
extra_args
:
"
-i
{{
COMMON_PYPI_MIRROR_URL
}}
--exists-action
w"
become_user
:
"
{{
xqueue_user
}}"
with_items
:
-
"
{{
xqueue_pre_requirements_file
}}"
-
"
{{
xqueue_post_requirements_file
}}"
tags
:
-
install
-
install:app-requirements
# If there is a common user for migrations run migrations using his username
# and credentials. If not we use the xqueue mysql user
-
name
:
migrate
shell
:
>
SERVICE_VARIANT=xqueue {{ xqueue_venv_bin }}/django-admin.py migrate --noinput --settings=xqueue.aws_migrate --pythonpath={{ xqueue_code_dir }}
-
name
:
Migrate
shell
:
"
SERVICE_VARIANT=xqueue
{{
xqueue_venv_bin
}}/django-admin.py
migrate
--noinput
--settings=xqueue.aws_migrate
--pythonpath={{
xqueue_code_dir
}}"
become_user
:
"
{{
xqueue_user
}}"
environment
:
DB_MIGRATION_USER
:
"
{{
COMMON_MYSQL_MIGRATE_USER
}}"
...
...
@@ -87,9 +85,8 @@
-
migrate
-
migrate:db
-
name
:
create users
shell
:
>
SERVICE_VARIANT=xqueue {{ xqueue_venv_bin }}/django-admin.py update_users --settings=xqueue.aws_settings --pythonpath={{ xqueue_code_dir }}
-
name
:
Create users
shell
:
"
SERVICE_VARIANT=xqueue
{{
xqueue_venv_bin
}}/django-admin.py
update_users
--settings=xqueue.aws_settings
--pythonpath={{
xqueue_code_dir
}}"
become_user
:
"
{{
xqueue_user
}}"
tags
:
-
manage
...
...
@@ -100,45 +97,45 @@
# the services if any of the configurations
# have changed.
#
-
name
:
u
pdate supervisor configuration
-
name
:
U
pdate supervisor configuration
shell
:
"
{{
supervisor_ctl
}}
-c
{{
supervisor_cfg
}}
update"
register
:
supervisor_update
changed_when
:
supervisor_update.stdout is defined and supervisor_update.stdout != ""
when
:
not disable_edx_services
-
name
:
e
nsure xqueue, consumer is running
supervisorctl
:
>
name
={{ item }}
supervisorctl_path
={{ supervisor_ctl }}
config
={{ supervisor_cfg }}
state
=
started
-
name
:
E
nsure xqueue, consumer is running
supervisorctl
:
name
:
"
{{
item
}}"
supervisorctl_path
:
"
{{
supervisor_ctl
}}"
config
:
"
{{
supervisor_cfg
}}"
state
:
started
with_items
:
-
xqueue
-
xqueue_consumer
-
xqueue
-
xqueue_consumer
when
:
not disable_edx_services
tags
:
-
manage
-
manage:start
-
name
:
c
reate a symlink for venv python
file
:
>
src
=
"{{ xqueue_venv_bin }}/{{ item }}"
dest
={{ COMMON_BIN_DIR }}/{{ item }}.xqueue
state
=
link
-
name
:
C
reate a symlink for venv python
file
:
src
:
"
{{
xqueue_venv_bin
}}/{{
item
}}"
dest
:
"
{{
COMMON_BIN_DIR
}}/{{
item
}}.xqueue"
state
:
link
with_items
:
-
python
-
pip
-
python
-
pip
tags
:
-
install
-
install:app-requirements
-
name
:
r
estart xqueue
supervisorctl
:
>
name
={{ item }}
supervisorctl_path
={{ supervisor_ctl }}
config
={{ supervisor_cfg }}
state
=
restarted
-
name
:
R
estart xqueue
supervisorctl
:
name
:
"
{{
item
}}"
supervisorctl_path
:
"
{{
supervisor_ctl
}}"
config
:
"
{{
supervisor_cfg
}}"
state
:
restarted
when
:
not disable_edx_services
with_items
:
-
xqueue
-
xqueue_consumer
-
xqueue
-
xqueue_consumer
playbooks/roles/xqueue/tasks/main.yml
View file @
92acf889
...
...
@@ -5,23 +5,22 @@
# Check out xqueue repo to {{ xqueue_code_dir }}
#
#
-
name
:
create application user
user
:
>
name="{{ xqueue_user }}"
home="{{ xqueue_app_dir }}"
createhome=no
shell=/bin/false
-
name
:
Create application user
user
:
name
:
"
{{
xqueue_user
}}"
home
:
"
{{
xqueue_app_dir
}}"
createhome
:
no
shell
:
/bin/false
tags
:
-
install
-
install:base
-
name
:
c
reate xqueue app and venv dir
file
:
>
path
=
"{{ item }}"
state
=
directory
owner
=
"{{ xqueue_user }}"
group
=
"{{ common_web_group }}"
-
name
:
C
reate xqueue app and venv dir
file
:
path
:
"
{{
item
}}"
state
:
directory
owner
:
"
{{
xqueue_user
}}"
group
:
"
{{
common_web_group
}}"
with_items
:
-
"
{{
xqueue_app_dir
}}"
-
"
{{
xqueue_venvs_dir
}}"
...
...
@@ -29,14 +28,15 @@
-
install
-
install:base
-
name
:
install a bunch of system packages on which xqueue relies
apt
:
pkg={{','.join(xqueue_debian_pkgs)}} state=present
-
name
:
Install a bunch of system packages on which xqueue relies
apt
:
name
:
"
{{
item
}}"
state
:
present
with_items
:
"
{{
xqueue_debian_pkgs
}}"
tags
:
-
install
-
install:system-requirements
-
include
:
deploy.yml tags=deploy
-
include
:
deploy.yml
tags
:
-
deploy
\ No newline at end of file
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