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
cb65e84e
Commit
cb65e84e
authored
Nov 08, 2013
by
John Jarvis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
supervisor service and file management refactor
parent
c5d07f35
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
364 additions
and
225 deletions
+364
-225
playbooks/roles/analytics-server/handlers/main.yml
+4
-2
playbooks/roles/analytics/handlers/main.yml
+4
-2
playbooks/roles/apache/handlers/main.yml
+1
-0
playbooks/roles/certs/handlers/main.yml
+1
-0
playbooks/roles/certs/tasks/deploy.yml
+20
-1
playbooks/roles/certs/tasks/main.yml
+0
-13
playbooks/roles/common/handlers/main.yml
+1
-0
playbooks/roles/datadog/handlers/main.yml
+2
-2
playbooks/roles/devpi/handlers/main.yml
+1
-0
playbooks/roles/discern/handlers/main.yml
+2
-0
playbooks/roles/discern/tasks/deploy.yml
+65
-0
playbooks/roles/discern/tasks/main.yml
+0
-25
playbooks/roles/edxapp/handlers/main.yml
+12
-9
playbooks/roles/edxapp/tasks/deploy.yml
+63
-17
playbooks/roles/edxapp/tasks/main.yml
+24
-0
playbooks/roles/edxapp/tasks/service_variant_config.yml
+15
-17
playbooks/roles/forum/handlers/main.yml
+1
-0
playbooks/roles/forum/tasks/deploy.yml
+30
-15
playbooks/roles/forum/tasks/main.yml
+0
-21
playbooks/roles/mongo/handlers/main.yml
+1
-0
playbooks/roles/nginx/handlers/main.yml
+2
-0
playbooks/roles/notifier/handlers/main.yml
+2
-0
playbooks/roles/ora/handlers/main.yml
+2
-0
playbooks/roles/ora/tasks/deploy.yml
+39
-0
playbooks/roles/ora/tasks/main.yml
+1
-23
playbooks/roles/xqueue/handlers/main.yml
+5
-28
playbooks/roles/xqueue/tasks/deploy.yml
+32
-7
playbooks/roles/xqueue/tasks/main.yml
+6
-23
playbooks/roles/xserver/handlers/main.yml
+1
-0
playbooks/roles/xserver/tasks/deploy.yml
+27
-0
playbooks/roles/xserver/tasks/main.yml
+0
-20
No files found.
playbooks/roles/analytics-server/handlers/main.yml
View file @
cb65e84e
...
...
@@ -10,13 +10,15 @@
#
#
# Handlers for role analytics-server
#
#
# Overview:
#
#
#
-
name
:
analytics-server | stop the analytics service
service
:
name=analytics state=stopped
tags
:
deploy
-
name
:
analytics-server | start the analytics service
service
:
name=analytics state=started
tags
:
deploy
playbooks/roles/analytics/handlers/main.yml
View file @
cb65e84e
...
...
@@ -10,13 +10,15 @@
#
#
# Handlers for role analytics
#
#
# Overview:
#
#
#
-
name
:
analytics | stop the analytics service
service
:
name=analytics state=stopped
tags
:
deploy
-
name
:
analytics | start the analytics service
service
:
name=analytics state=started
tags
:
deploy
playbooks/roles/apache/handlers/main.yml
View file @
cb65e84e
---
-
name
:
apache | restart apache
service
:
name=apache2 state=restarted
tags
:
deploy
playbooks/roles/certs/handlers/main.yml
View file @
cb65e84e
...
...
@@ -20,4 +20,5 @@
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=restarted
tags
:
deploy
playbooks/roles/certs/tasks/deploy.yml
View file @
cb65e84e
...
...
@@ -19,7 +19,7 @@
-
name
:
certs | writing supervisor script for certificates
template
:
>
src=certs.conf.j2 dest={{ supervisor_cfg_dir }}/certs.conf
owner={{ supervisor_user }}
group={{ common_web_user }}
mode=0644
owner={{ supervisor_user }} mode=0644
notify
:
certs | restart certs
tags
:
deploy
...
...
@@ -55,3 +55,22 @@
sudo_user
:
"
{{
certs_user
}}"
notify
:
certs | restart certs
tags
:
deploy
# call supervisorctl update. this reloads
# the supervisorctl config and restarts
# the services if any of the configurations
# have changed.
#
-
name
:
certs | update supervisor configuration
shell
:
"
{{
supervisor_ctl
}}
-c
{{
supervisor_cfg
}}
update"
register
:
supervisor_update
sudo_user
:
"
{{
supervisor_service_user
}}"
changed_when
:
supervisor_update.stdout != ""
-
name
:
certs | ensure certs has started
supervisorctl
:
>
name=certs
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=started
sudo_user
:
"
{{
supervisor_service_user
}}"
playbooks/roles/certs/tasks/main.yml
View file @
cb65e84e
...
...
@@ -88,16 +88,3 @@
with_items
:
-
python
-
pip
# call supervisorctl update. this reloads
# the supervisorctl config and restarts
# the services if any of the configurations
# have changed.
#
# we don't use notifications for supervisor because
# they don't work well with parameterized roles.
# See https://github.com/ansible/ansible/issues/4853
-
name
:
certs | update supervisor configuration
shell
:
"
{{
supervisor_ctl
}}
-c
{{
supervisor_cfg
}}
update"
register
:
supervisor_update
changed_when
:
supervisor_update.stdout != ""
playbooks/roles/common/handlers/main.yml
View file @
cb65e84e
...
...
@@ -2,3 +2,4 @@
-
name
:
common | restart rsyslogd
service
:
name=rsyslog state=restarted
sudo
:
True
tags
:
deploy
playbooks/roles/datadog/handlers/main.yml
View file @
cb65e84e
---
-
name
:
datadog | restart the datadog service
service
:
name=datadog-agent state=restarted
\ No newline at end of file
service
:
name=datadog-agent state=restarted
tags
:
deploy
playbooks/roles/devpi/handlers/main.yml
View file @
cb65e84e
...
...
@@ -18,3 +18,4 @@
config={{ devpi_supervisor_cfg }}
name=devpi-server
sudo_user
:
"
{{
devpi_supervisor_user
}}"
tags
:
deploy
playbooks/roles/discern/handlers/main.yml
View file @
cb65e84e
...
...
@@ -5,10 +5,12 @@
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=restarted
tags
:
deploy
-
name
:
discern | restart discern_celery
supervisorctl
:
>
name=discern_celery
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
tags
:
deploy
state=restarted
playbooks/roles/discern/tasks/deploy.yml
View file @
cb65e84e
---
-
name
:
discern | create supervisor scripts - discern, discern_celery
template
:
>
src={{ item }}.conf.j2 dest={{ supervisor_cfg_dir }}/{{ item }}.conf
owner={{ supervisor_user }} mode=0644
sudo_user
:
"
{{
supervisor_user
}}"
with_items
:
[
'
discern'
,
'
discern_celery'
]
#Upload config files for django (auth and env)
-
name
:
discern | create discern application config env.json file
template
:
src=env.json.j2 dest={{ discern_app_dir }}/env.json
...
...
@@ -109,3 +116,61 @@
-
discern | restart discern
tags
:
-
deploy
# call supervisorctl update. this reloads
# the supervisorctl config and restarts
# the services if any of the configurations
# have changed.
#
# we don't use notifications for supervisor because
# they don't work well with parameterized roles.
# See https://github.com/ansible/ansible/issues/4853
-
name
:
discern | update supervisor configuration
shell
:
"
{{
supervisor_ctl
}}
-c
{{
supervisor_cfg
}}
update"
register
:
supervisor_update
sudo_user
:
"
{{
supervisor_service_user
}}"
changed_when
:
supervisor_update.stdout != ""
-
name
:
discern | ensure discern has started
supervisorctl
:
>
name=discern
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=started
sudo_user
:
"
{{
supervisor_service_user
}}"
-
name
:
discern_celery | ensure discern_celery has started
supervisorctl
:
>
name=discern_celery
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=started
sudo_user
:
"
{{
supervisor_service_user
}}"
# call supervisorctl update. this reloads
# the supervisorctl config and restarts
# the services if any of the configurations
# have changed.
#
-
name
:
discern | update supervisor configuration
shell
:
"
{{
supervisor_ctl
}}
-c
{{
supervisor_cfg
}}
update"
register
:
supervisor_update
sudo_user
:
"
{{
supervisor_service_user
}}"
changed_when
:
supervisor_update.stdout != ""
-
name
:
discern | ensure discern, discern_celery has started
supervisorctl
:
>
name={{ item }}
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=started
with_items
:
-
discern
-
discern_celery
-
name
:
discern | create a symlink for venv python
file
:
>
src="{{ discern_venv_bin }}/python"
dest={{ COMMON_BIN_DIR }}/python.discern
state=link
playbooks/roles/discern/tasks/main.yml
View file @
cb65e84e
...
...
@@ -60,29 +60,4 @@
-
discern | restart discern_celery
-
discern | restart discern
-
name
:
discern | create supervisor scripts - discern, discern_celery
template
:
>
src={{ item }}.conf.j2 dest={{ supervisor_cfg_dir }}/{{ item }}.conf
owner={{ supervisor_user }} group={{ common_web_user }} mode=0644
with_items
:
[
'
discern'
,
'
discern_celery'
]
-
include
:
deploy.yml
# call supervisorctl update. this reloads
# the supervisorctl config and restarts
# the services if any of the configurations
# have changed.
#
# we don't use notifications for supervisor because
# they don't work well with parameterized roles.
# See https://github.com/ansible/ansible/issues/4853
-
name
:
discern | update supervisor configuration
shell
:
"
{{
supervisor_ctl
}}
-c
{{
supervisor_cfg
}}
update"
register
:
supervisor_update
changed_when
:
supervisor_update.stdout != ""
-
name
:
discern | create a symlink for venv python
file
:
>
src="{{ discern_venv_bin }}/python"
dest={{ COMMON_BIN_DIR }}/python.discern
state=link
playbooks/roles/edxapp/handlers/main.yml
View file @
cb65e84e
---
-
name
:
"
edxapp
|
restart
edxapp
:lms
"
-
name
:
"
edxapp
|
restart
edxapp"
supervisorctl
:
>
state=restarted
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
name="edxapp:lms"
sudo_user
:
"
{{
supervisor_user
}}"
name="edxapp:{{ item }}"
sudo_user
:
"
{{
supervisor_service_user
}}"
with_items
:
service_variants_enabled
tags
:
deploy
-
name
:
"
edxapp
|
restart
edxapp
:cm
s"
-
name
:
"
edxapp
|
restart
edxapp
_worker
s"
supervisorctl
:
>
state=restarted
name="edxapp_worker:{{ item.service_variant }}_{{ item.queue }}_{{ item.concurrency }}"
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
name="edxapp:cms"
sudo_user
:
"
{{
supervisor_user
}}"
state=restarted
when
:
celery_worker is defined
with_items
:
edxapp_workers
sudo_user
:
"
{{
common_web_user
}}"
tags
:
deploy
playbooks/roles/edxapp/tasks/deploy.yml
View file @
cb65e84e
# Stop all services.
#
#
# TODO: the supervisor ansible module does not support
# stopping and starting services by group.
# Do A Checkout
-
name
:
edxapp | checkout edx-platform repo into {{edxapp_code_dir}}
git
:
dest={{edxapp_code_dir}} repo={{edx_platform_repo}} version={{edx_platform_commit}}
register
:
chkout
sudo_user
:
"
{{
edxapp_user
}}"
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
tags
:
deploy
-
name
:
edxapp | git clean after checking out edx-platform
shell
:
cd {{edxapp_code_dir}} && git clean -xdf
sudo_user
:
"
{{
edxapp_user
}}"
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
tags
:
deploy
-
name
:
edxapp | checkout theme
git
:
dest={{ edxapp_app_dir }}/themes/{{edxapp_theme_name}} repo={{edxapp_theme_source_repo}} version={{edxapp_theme_version}}
when
:
edxapp_theme_name != ''
sudo_user
:
"
{{
edxapp_user
}}"
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
tags
:
-
deploy
...
...
@@ -48,6 +50,9 @@
command
:
|
/bin/sed -i -e 's/github\.com/{{ COMMON_GIT_MIRROR }}/g' {{ " ".join(edxapp_all_req_files) }}
sudo_user
:
"
{{
edxapp_user
}}"
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
tags
:
deploy
# Ruby plays that need to be run after platform updates.
...
...
@@ -58,6 +63,9 @@
executable=/bin/bash
environment
:
"
{{
edxapp_environment
}}"
sudo_user
:
"
{{
edxapp_user
}}"
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
tags
:
deploy
-
name
:
edxapp | bundle install
...
...
@@ -67,6 +75,9 @@
executable=/bin/bash
sudo_user
:
"
{{
edxapp_user
}}"
environment
:
"
{{
edxapp_environment
}}"
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
tags
:
deploy
# Node play that need to be run after platform updates.
...
...
@@ -74,6 +85,9 @@
shell
:
npm install chdir={{ edxapp_code_dir }}
sudo_user
:
"
{{
edxapp_user
}}"
environment
:
"
{{
edxapp_environment
}}"
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
tags
:
deploy
...
...
@@ -86,6 +100,9 @@
extra_args="-i {{ edxapp_pypi_local_mirror }}"
sudo_user
:
"
{{
edxapp_user
}}"
environment
:
"
{{
edxapp_environment
}}"
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
when
:
not inst.stat.exists or new.stat.md5 != inst.stat.md5
tags
:
deploy
...
...
@@ -99,6 +116,9 @@
chdir={{ edxapp_code_dir }}
environment
:
"
{{
edxapp_environment
}}"
sudo_user
:
"
{{
edxapp_user
}}"
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
when
:
not inst.stat.exists or new.stat.md5 != inst.stat.md5
tags
:
deploy
...
...
@@ -111,6 +131,9 @@
extra_args="-i {{ edxapp_pypi_local_mirror }}"
sudo_user
:
"
{{
edxapp_user
}}"
environment
:
"
{{
edxapp_environment
}}"
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
when
:
not inst.stat.exists or new.stat.md5 != inst.stat.md5
tags
:
deploy
...
...
@@ -125,6 +148,9 @@
-
"
{{
github_requirements_file
}}"
-
"
{{
local_requirements_file
}}"
sudo_user
:
"
{{
edxapp_user
}}"
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
tags
:
deploy
...
...
@@ -141,11 +167,17 @@
when
:
install_sandbox_reqs_into_regular_venv
sudo_user
:
"
{{
edxapp_user
}}"
when
:
not inst.stat.exists or new.stat.md5 != inst.stat.md5
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
tags
:
deploy
-
name
:
edxapp | compiling all py files in the edx-platform repo
shell
:
"
{{
edxapp_venv_bin
}}/python
-m
compileall
{{
edxapp_code_dir
}}"
sudo_user
:
"
{{
edxapp_user
}}"
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
tags
:
deploy
# alternative would be to give {{ common_web_user }} read access
...
...
@@ -154,11 +186,15 @@
-
name
:
edxapp | give other read permissions to the virtualenv
command
:
chmod -R o+r "{{ edxapp_venv_dir }}"
sudo_user
:
"
{{
edxapp_user
}}"
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
tags
:
deploy
-
name
:
edxapp | create checksum for installed requirements
shell
:
cp /var/tmp/edxapp.req.new /var/tmp/edxapp.req.installed
sudo_user
:
"
{{
edxapp_user
}}"
notify
:
"
edxapp
|
restart
edxapp"
tags
:
deploy
...
...
@@ -170,6 +206,9 @@
shell
:
sed -i -e 's/claimed_id = models.TextField(max_length=2047, unique=True/claimed_id = models.TextField(max_length=2047/' {{ edxapp_venv_dir }}/lib/python2.7/site-packages/django_openid_auth/models.py
when
:
openid_workaround is defined
sudo_user
:
"
{{
edxapp_user
}}"
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
tags
:
-
deploy
...
...
@@ -178,19 +217,27 @@
# gather_assets and db migrations
-
include
:
service_variant_config.yml
-
name
:
edxapp | restart the edxapp services (supervisor)
# call supervisorctl update. this reloads
# the supervisorctl config and restarts
# the services if any of the configurations
# have changed.
-
name
:
edxapp | update supervisor configuration
shell
:
"
{{
supervisor_ctl
}}
-c
{{
supervisor_cfg
}}
update"
register
:
supervisor_update
sudo_user
:
"
{{
supervisor_service_user
}}"
changed_when
:
supervisor_update.stdout != ""
-
name
:
edxapp | ensure edxapp has started
supervisorctl
:
>
name="edxapp:{{ item }}"
state=restarted
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=restarted
when
:
celery_worker is not defined
name="edxapp:{{ item }}"
sudo_user
:
"
{{
supervisor_service_user
}}"
with_items
:
service_variants_enabled
sudo_user
:
"
{{
common_web_user
}}"
tags
:
-
deploy
-
name
:
edxapp |
restart the celery worker services (supervisor)
-
name
:
edxapp |
ensure edxapp_workers has started
supervisorctl
:
>
name="edxapp_worker:{{ item.service_variant }}_{{ item.queue }}_{{ item.concurrency }}"
supervisorctl_path={{ supervisor_ctl }}
...
...
@@ -198,6 +245,5 @@
state=restarted
when
:
celery_worker is defined
with_items
:
edxapp_workers
sudo_user
:
"
{{
common_web
_user
}}"
sudo_user
:
"
{{
supervisor_service
_user
}}"
tags
:
-
deploy
playbooks/roles/edxapp/tasks/main.yml
View file @
cb65e84e
...
...
@@ -6,16 +6,25 @@
-
name
:
edxapp | Install logrotate configuration for tracking file
template
:
dest=/etc/logrotate.d/tracking.log src=edx_logrotate_tracking_log.j2 owner=root group=root mode=644
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
-
name
:
edxapp | create application user
user
:
>
name="{{ edxapp_user }}" home="{{ edxapp_app_dir }}"
createhome=no shell=/bin/false
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
-
name
:
edxapp | create edxapp user dirs
file
:
>
path="{{ item }}" state=directory
owner="{{ edxapp_user }}" group="{{ common_web_group }}"
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
with_items
:
-
"
{{
edxapp_app_dir
}}"
-
"
{{
edxapp_data_dir
}}"
...
...
@@ -27,20 +36,32 @@
file
:
>
path="{{ edxapp_log_dir }}" state=directory
owner="{{ common_log_user }}" group="{{ common_log_user }}"
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
-
name
:
edxapp | create web-writable edxapp data dirs
file
:
>
path="{{ item }}" state=directory
owner="{{ common_web_user }}" group="{{ edxapp_user }}"
mode="0775"
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
with_items
:
-
"
{{
edxapp_course_data_dir
}}"
-
"
{{
edxapp_upload_dir
}}"
-
name
:
edxapp | install system packages on which LMS and CMS rely
apt
:
pkg={{','.join(edxapp_debian_pkgs)}} state=present
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
-
name
:
edxapp | create log directories for service variants
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
file
:
>
path={{ edxapp_log_dir }}/{{ item }} state=directory
owner={{ common_log_user }} group={{ common_log_user }}
...
...
@@ -48,6 +69,9 @@
with_items
:
service_variants_enabled
-
name
:
edxapp | setup the edxapp env
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
template
:
>
src=edxapp_env.j2 dest={{ edxapp_app_dir }}/edxapp_env
owner={{ edxapp_user }} group={{ common_web_user }}
...
...
playbooks/roles/edxapp/tasks/service_variant_config.yml
View file @
cb65e84e
...
...
@@ -4,7 +4,9 @@
dest={{ edxapp_app_dir }}/{{ item }}.env.json
sudo_user
:
"
{{
edxapp_user
}}"
with_items
:
service_variants_enabled
notify
:
"
edxapp
|
restart
edxapp:{{
item
}}"
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
tags
:
-
deploy
...
...
@@ -13,7 +15,9 @@
src={{ item }}.auth.json.j2
dest={{ edxapp_app_dir }}/{{ item }}.auth.json
sudo_user
:
"
{{
edxapp_user
}}"
notify
:
"
edxapp
|
restart
edxapp:{{
item
}}"
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
with_items
:
service_variants_enabled
tags
:
-
deploy
...
...
@@ -50,19 +54,6 @@
tags
:
-
deploy
# call supervisorctl update. this reloads
# the supervisorctl config and restarts
# the services if any of the configurations
# have changed.
#
# we don't use notifications for supervisor because
# they don't work well with parameterized roles.
# See https://github.com/ansible/ansible/issues/4853
-
name
:
edxapp | update supervisor configuration
shell
:
"
{{
supervisor_ctl
}}
-c
{{
supervisor_cfg
}}
update"
register
:
supervisor_update
changed_when
:
supervisor_update.stdout != ""
# Gather assets using rake if possible
...
...
@@ -74,6 +65,9 @@
sudo_user
:
"
{{
edxapp_user
}}"
when
:
celery_worker is not defined
with_items
:
service_variants_enabled
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
environment
:
"
{{
edxapp_environment
}}"
tags
:
-
deploy
...
...
@@ -83,14 +77,18 @@
shell
:
SERVICE_VARIANT=lms {{ edxapp_venv_bin}}/django-admin.py syncdb --migrate --noinput --settings=lms.envs.aws --pythonpath={{ edxapp_code_dir }}
when
:
migrate_db is defined and migrate_db|lower == "yes"
sudo_user
:
"
{{
edxapp_user
}}"
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
tags
:
-
deploy
-
name
:
edxapp | db migrate
shell
:
SERVICE_VARIANT=lms {{ edxapp_venv_bin }}/django-admin.py migrate --noinput --settings=lms.envs.aws --pythonpath={{ edxapp_code_dir }}
when
:
migrate_only is defined and migrate_only|lower == "yes"
notify
:
-
"
edxapp
|
restart
edxapp"
-
"
edxapp
|
restart
edxapp_workers"
sudo_user
:
"
{{
edxapp_user
}}"
tags
:
-
deploy
playbooks/roles/forum/handlers/main.yml
View file @
cb65e84e
...
...
@@ -5,3 +5,4 @@
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=restarted
tags
:
deploy
playbooks/roles/forum/tasks/deploy.yml
View file @
cb65e84e
---
-
name
:
forum | create the supervisor config
template
:
>
src=forum.conf.j2 dest={{ supervisor_cfg_dir }}/forum.conf
owner={{ supervisor_user }}
mode=0644
sudo_user
:
"
{{
supervisor_user
}}"
register
:
forum_supervisor
tags
:
deploy
-
name
:
forum | create the supervisor wrapper
template
:
>
src={{ forum_supervisor_wrapper|basename }}.j2
...
...
@@ -7,15 +16,13 @@
mode=0755
sudo_user
:
"
{{
forum_user
}}"
notify
:
forum | restart the forum service
tags
:
-
deploy
tags
:
deploy
-
name
:
forum | git checkout forum repo into {{ forum_code_dir }}
git
:
dest={{ forum_code_dir }} repo={{ forum_source_repo }} version={{ forum_version }}
sudo_user
:
"
{{
forum_user
}}"
notify
:
forum | restart the forum service
tags
:
-
deploy
tags
:
deploy
# TODO: This is done as the common_web_user
# since the process owner needs write access
...
...
@@ -25,15 +32,23 @@
sudo_user
:
"
{{
common_web_user
}}"
environment
:
"
{{
forum_environment
}}"
notify
:
forum | restart the forum service
tags
:
-
deploy
tags
:
deploy
-
name
:
forum | create the supervisor config
template
:
>
src=forum.conf.j2 dest={{ supervisor_cfg_dir }}/forum.conf
owner={{ common_web_user }} group={{ supervisor_user }}
mode=0644
register
:
forum_supervisor
notify
:
forum | restart the forum service
tags
:
-
deploy
# call supervisorctl update. this reloads
# the supervisorctl config and restarts
# the services if any of the configurations
# have changed.
#
-
name
:
forum | update supervisor configuration
shell
:
"
{{
supervisor_ctl
}}
-c
{{
supervisor_cfg
}}
update"
register
:
supervisor_update
changed_when
:
supervisor_update.stdout != ""
tags
:
deploy
-
name
:
forum | ensure forum is started
supervisorctl
:
>
name=forum
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=started
tags
:
deploy
playbooks/roles/forum/tasks/main.yml
View file @
cb65e84e
...
...
@@ -42,27 +42,6 @@
notify
:
-
forum | restart the forum service
-
name
:
forum | create the supervisor config
template
:
>
src=forum.conf.j2 dest={{ supervisor_cfg_dir }}/forum.conf
owner={{ common_web_user }} group={{ supervisor_user }}
mode=0644
register
:
forum_supervisor
-
include
:
deploy.yml
# call supervisorctl update. this reloads
# the supervisorctl config and restarts
# the services if any of the configurations
# have changed.
#
# we don't use notifications for supervisor because
# they don't work well with parameterized roles.
# See https://github.com/ansible/ansible/issues/4853
-
name
:
forum | update supervisor configuration
shell
:
"
{{
supervisor_ctl
}}
-c
{{
supervisor_cfg
}}
update"
register
:
supervisor_update
changed_when
:
supervisor_update.stdout != ""
-
include
:
test.yml
playbooks/roles/mongo/handlers/main.yml
View file @
cb65e84e
---
-
name
:
restart mongo
service
:
name=mongodb state=restarted
tags
:
deploy
playbooks/roles/nginx/handlers/main.yml
View file @
cb65e84e
---
-
name
:
nginx | restart nginx
service
:
name=nginx state=restarted
tags
:
deploy
-
name
:
nginx | reload nginx
service
:
name=nginx state=reloaded
tags
:
deploy
playbooks/roles/notifier/handlers/main.yml
View file @
cb65e84e
...
...
@@ -6,6 +6,7 @@
state=restarted
config={{ supervisor_cfg }}
supervisorctl_path={{ supervisor_ctl }}
tags
:
deploy
-
name
:
notifier | restart notifier-celery-workers
supervisorctl
:
>
...
...
@@ -13,3 +14,4 @@
state=restarted
config={{ supervisor_cfg }}
supervisorctl_path={{ supervisor_ctl }}
tags
:
deploy
playbooks/roles/ora/handlers/main.yml
View file @
cb65e84e
...
...
@@ -5,6 +5,7 @@
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=restarted
tags
:
deploy
-
name
:
ora | restart ora_celery
supervisorctl
:
>
...
...
@@ -12,3 +13,4 @@
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=restarted
tags
:
deploy
playbooks/roles/ora/tasks/deploy.yml
View file @
cb65e84e
-
name
:
ora | create supervisor scripts - ora, ora_celery
template
:
>
src={{ item }}.conf.j2 dest={{ supervisor_cfg_dir }}/{{ item }}.conf
owner={{ supervisor_user }} group={{ common_web_user }} mode=0644
notify
:
-
ora | restart ora
-
ora | restart ora_celery
with_items
:
[
'
ora'
,
'
ora_celery'
]
tags
:
-
deploy
-
include
:
ease.yml
-
name
:
ora | create ora application config
...
...
@@ -73,3 +84,31 @@
-
ora | restart ora_celery
tags
:
-
deploy
# call supervisorctl update. this reloads
# the supervisorctl config and restarts
# the services if any of the configurations
# have changed.
#
-
name
:
ora | update supervisor configuration
shell
:
"
{{
supervisor_ctl
}}
-c
{{
supervisor_cfg
}}
update"
register
:
supervisor_update
changed_when
:
supervisor_update.stdout != ""
tags
:
deploy
-
name
:
ora | ensure ora is started
supervisorctl
:
>
name=ora
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=started
tags
:
deploy
-
name
:
ora | ensure ora_celery is started
supervisorctl
:
>
name=ora_celery
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=started
tags
:
deploy
playbooks/roles/ora/tasks/main.yml
View file @
cb65e84e
...
...
@@ -47,17 +47,6 @@
-
ora | restart ora_celery
with_items
:
ora_ease_debian_pkgs
-
name
:
ora | create supervisor scripts - ora, ora_celery
template
:
>
src={{ item }}.conf.j2 dest={{ supervisor_cfg_dir }}/{{ item }}.conf
owner={{ supervisor_user }} group={{ common_web_user }} mode=0644
notify
:
-
ora | restart ora
-
ora | restart ora_celery
with_items
:
[
'
ora'
,
'
ora_celery'
]
tags
:
-
deploy
-
include
:
deploy.yml
-
name
:
ora | create a symlink for venv python
...
...
@@ -68,15 +57,4 @@
-
python
-
pip
# call supervisorctl update. this reloads
# the supervisorctl config and restarts
# the services if any of the configurations
# have changed.
#
# we don't use notifications for supervisor because
# they don't work well with parameterized roles.
# See https://github.com/ansible/ansible/issues/4853
-
name
:
ora | update supervisor configuration
shell
:
"
{{
supervisor_ctl
}}
-c
{{
supervisor_cfg
}}
update"
register
:
supervisor_update
changed_when
:
supervisor_update.stdout != ""
playbooks/roles/xqueue/handlers/main.yml
View file @
cb65e84e
-
name
:
xqueue | stop xqueue
supervisorctl
:
>
name=xqueue
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=stopped
tags
:
-
deploy
-
name
:
xqueue | start xqueue
supervisorctl
:
>
name=xqueue
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=started
tags
:
-
deploy
-
name
:
xqueue | restart xqueue
supervisorctl
:
>
name=xqueue
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=restarted
tags
:
-
deploy
-
name
:
xqueue | restart xqueue consumer
supervisorctl
:
>
name=xqueue_consumer
name={{ item }}
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=restarted
with_items
:
-
xqueue
-
xqueue_consumer
tags
:
deploy
playbooks/roles/xqueue/tasks/deploy.yml
View file @
cb65e84e
-
name
:
"
xqueue
|
writing
supervisor
scripts
-
xqueue,
xqueue
consumer"
template
:
>
src={{ item }}.conf.j2 dest={{ supervisor_cfg_dir }}/{{ item }}.conf
owner={{ supervisor_user }} group={{ common_web_user }} mode=0644
with_items
:
[
'
xqueue'
,
'
xqueue_consumer'
]
tags
:
-
deploy
-
name
:
xqueue | create xqueue application config
template
:
src=xqueue.env.json.j2 dest={{ xqueue_app_dir }}/xqueue.env.json mode=0644
sudo_user
:
"
{{
xqueue_user
}}"
notify
:
-
xqueue | restart xqueue
-
xqueue | restart xqueue consumer
tags
:
-
deploy
...
...
@@ -12,7 +20,6 @@
sudo_user
:
"
{{
xqueue_user
}}"
notify
:
-
xqueue | restart xqueue
-
xqueue | restart xqueue consumer
tags
:
-
deploy
...
...
@@ -22,7 +29,6 @@
sudo_user
:
"
{{
xqueue_user
}}"
notify
:
-
xqueue | restart xqueue
-
xqueue | restart xqueue consumer
tags
:
-
deploy
...
...
@@ -33,7 +39,6 @@
sudo_user
:
"
{{
xqueue_user
}}"
notify
:
-
xqueue | restart xqueue
-
xqueue | restart xqueue consumer
tags
:
-
deploy
...
...
@@ -43,7 +48,6 @@
sudo_user
:
"
{{
xqueue_user
}}"
notify
:
-
xqueue | restart xqueue
-
xqueue | restart xqueue consumer
tags
:
-
deploy
...
...
@@ -54,7 +58,6 @@
sudo_user
:
"
{{
xqueue_user
}}"
notify
:
-
xqueue | restart xqueue
-
xqueue | restart xqueue consumer
tags
:
-
deploy
...
...
@@ -64,6 +67,28 @@
sudo_user
:
"
{{
xqueue_user
}}"
notify
:
-
xqueue | restart xqueue
-
xqueue | restart xqueue consumer
tags
:
-
deploy
# call supervisorctl update. this reloads
# the supervisorctl config and restarts
# the services if any of the configurations
# have changed.
#
-
name
:
xqueue | update supervisor configuration
shell
:
"
{{
supervisor_ctl
}}
-c
{{
supervisor_cfg
}}
update"
register
:
supervisor_update
changed_when
:
supervisor_update.stdout != ""
tags
:
deploy
-
name
:
xqueue | ensure xqueue, consumer is running
supervisorctl
:
>
name={{ item }}
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=started
with_items
:
-
xqueue
-
xqueue_consumer
tags
:
deploy
playbooks/roles/xqueue/tasks/main.yml
View file @
cb65e84e
...
...
@@ -12,6 +12,8 @@
home="{{ xqueue_app_dir }}"
createhome=no
shell=/bin/false
notify
:
-
xqueue | restart xqueue
-
name
:
xqueue | create xqueue app and venv dir
file
:
>
...
...
@@ -19,6 +21,8 @@
state=directory
owner="{{ xqueue_user }}"
group="{{ common_web_group }}"
notify
:
-
xqueue | restart xqueue
with_items
:
-
"
{{
xqueue_app_dir
}}"
-
"
{{
xqueue_venvs_dir
}}"
...
...
@@ -27,8 +31,6 @@
apt
:
pkg={{','.join(xqueue_debian_pkgs)}} state=present
notify
:
-
xqueue | restart xqueue
-
xqueue | restart xqueue consumer
-
name
:
xqueue | create xqueue db
mysql_db
:
>
...
...
@@ -38,31 +40,12 @@
login_password={{xqueue_auth_config.DATABASES.default.PASSWORD}}
state=present
encoding=utf8
notify
:
-
xqueue | restart xqueue
when
:
xqueue_create_db is defined and xqueue_create_db|lower == "yes"
-
name
:
"
xqueue
|
writing
supervisor
scripts
-
xqueue,
xqueue
consumer"
template
:
>
src={{ item }}.conf.j2 dest={{ supervisor_cfg_dir }}/{{ item }}.conf
owner={{ supervisor_user }} group={{ common_web_user }} mode=0644
with_items
:
[
'
xqueue'
,
'
xqueue_consumer'
]
tags
:
-
deploy
-
include
:
deploy.yml
# call supervisorctl update. this reloads
# the supervisorctl config and restarts
# the services if any of the configurations
# have changed.
#
# we don't use notifications for supervisor because
# they don't work well with parameterized roles.
# See https://github.com/ansible/ansible/issues/4853
-
name
:
xqueue | update supervisor configuration
shell
:
"
{{
supervisor_ctl
}}
-c
{{
supervisor_cfg
}}
update"
register
:
supervisor_update
changed_when
:
supervisor_update.stdout != ""
-
name
:
xqueue | create a symlink for venv python
file
:
>
src="{{ xqueue_venv_bin }}/{{ item }}"
...
...
playbooks/roles/xserver/handlers/main.yml
View file @
cb65e84e
...
...
@@ -20,4 +20,5 @@
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=restarted
tags
:
deploy
playbooks/roles/xserver/tasks/deploy.yml
View file @
cb65e84e
-
name
:
"
xserver
|
writing
supervisor
script"
template
:
>
src=xserver.conf.j2 dest={{ supervisor_cfg_dir }}/xserver.conf
owner={{ supervisor_user }} group={{ common_web_user }} mode=0644
tags
:
-
deploy
-
name
:
xserver | checkout code
git
:
dest={{xserver_code_dir}} repo={{xserver_source_repo}} version={{xserver_version}}
sudo_user
:
"
{{
xserver_user
}}"
...
...
@@ -56,3 +63,23 @@
notify
:
xserver | restart xserver
tags
:
-
deploy
# call supervisorctl update. this reloads
# the supervisorctl config and restarts
# the services if any of the configurations
# have changed.
#
-
name
:
xserver | update supervisor configuration
shell
:
"
{{
supervisor_ctl
}}
-c
{{
supervisor_cfg
}}
update"
register
:
supervisor_update
changed_when
:
supervisor_update.stdout != ""
tags
:
deploy
-
name
:
xserver | ensure xserver is started
supervisorctl
:
>
name=xserver
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=started
tags
:
deploy
playbooks/roles/xserver/tasks/main.yml
View file @
cb65e84e
...
...
@@ -62,14 +62,6 @@
-
"
{{
secure_dir
}}/files/edx_apparmor_sandbox.j2"
-
"
usr.bin.python-sandbox.j2"
-
name
:
"
xserver
|
writing
supervisor
script"
template
:
>
src=xserver.conf.j2 dest={{ supervisor_cfg_dir }}/xserver.conf
owner={{ supervisor_user }} group={{ common_web_user }} mode=0644
tags
:
-
deploy
-
include
:
deploy.yml
-
name
:
xserver | enforce app-armor rules
...
...
@@ -84,15 +76,3 @@
-
python
-
pip
# call supervisorctl update. this reloads
# the supervisorctl config and restarts
# the services if any of the configurations
# have changed.
#
# we don't use notifications for supervisor because
# they don't work well with parameterized roles.
# See https://github.com/ansible/ansible/issues/4853
-
name
:
xserver | update supervisor configuration
shell
:
"
{{
supervisor_ctl
}}
-c
{{
supervisor_cfg
}}
update"
register
:
supervisor_update
changed_when
:
supervisor_update.stdout != ""
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