Commit aa0c2188 by John Jarvis

Merge pull request #666 from edx/jarv/stop-services

Jarv/stop services
parents 9aee2095 58f1e3c5
...@@ -20,4 +20,4 @@ ...@@ -20,4 +20,4 @@
supervisorctl_path={{ supervisor_ctl }} supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }} config={{ supervisor_cfg }}
state=restarted state=restarted
when: start_services and certs_installed is defined
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
register: supervisor_update register: supervisor_update
sudo_user: "{{ supervisor_service_user }}" sudo_user: "{{ supervisor_service_user }}"
changed_when: supervisor_update.stdout != "" changed_when: supervisor_update.stdout != ""
when: start_services
- name: certs | ensure certs has started - name: certs | ensure certs has started
supervisorctl_local: > supervisorctl_local: >
...@@ -66,6 +67,7 @@ ...@@ -66,6 +67,7 @@
config={{ supervisor_cfg }} config={{ supervisor_cfg }}
state=started state=started
sudo_user: "{{ supervisor_service_user }}" sudo_user: "{{ supervisor_service_user }}"
when: start_services
- name: certs | create a symlink for venv python - name: certs | create a symlink for venv python
file: > file: >
...@@ -76,3 +78,5 @@ ...@@ -76,3 +78,5 @@
with_items: with_items:
- python - python
- pip - pip
- set_fact: certs_installed=true
...@@ -49,3 +49,6 @@ common_git_ppa: "ppa:git-core/ppa" ...@@ -49,3 +49,6 @@ common_git_ppa: "ppa:git-core/ppa"
# Skip supervisor tasks # Skip supervisor tasks
# Useful when supervisor is not installed (local dev) # Useful when supervisor is not installed (local dev)
devstack: False devstack: False
# By default start services on ansible runs
start_services: True
...@@ -40,4 +40,3 @@ ...@@ -40,4 +40,3 @@
chdir={{ edxapp_code_dir }} chdir={{ edxapp_code_dir }}
with_items: demo_test_users with_items: demo_test_users
when: demo_checkout.changed when: demo_checkout.changed
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
supervisorctl_path={{ supervisor_ctl }} supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }} config={{ supervisor_cfg }}
state=restarted state=restarted
when: discern_installed is defined when: start_services and discern_installed is defined
with_items: with_items:
- discern - discern
- discern_celery - discern_celery
...@@ -103,6 +103,7 @@ ...@@ -103,6 +103,7 @@
shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update" shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update"
register: supervisor_update register: supervisor_update
sudo_user: "{{ supervisor_service_user }}" sudo_user: "{{ supervisor_service_user }}"
when: start_services
changed_when: supervisor_update.stdout != "" changed_when: supervisor_update.stdout != ""
- name: discern | ensure discern, discern_celery has started - name: discern | ensure discern, discern_celery has started
...@@ -111,6 +112,7 @@ ...@@ -111,6 +112,7 @@
supervisorctl_path={{ supervisor_ctl }} supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }} config={{ supervisor_cfg }}
state=started state=started
when: start_services
with_items: with_items:
- discern - discern
- discern_celery - discern_celery
...@@ -122,4 +124,3 @@ ...@@ -122,4 +124,3 @@
state=link state=link
- set_fact: discern_installed=true - set_fact: discern_installed=true
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
supervisorctl_path={{ supervisor_ctl }} supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }} config={{ supervisor_cfg }}
name="edxapp:{{ item }}" name="edxapp:{{ item }}"
when: edxapp_installed is defined and celery_worker is not defined and not devstack when: start_services and edxapp_installed is defined and celery_worker is not defined and not devstack
sudo_user: "{{ supervisor_service_user }}" sudo_user: "{{ supervisor_service_user }}"
with_items: service_variants_enabled with_items: service_variants_enabled
...@@ -15,6 +15,6 @@ ...@@ -15,6 +15,6 @@
supervisorctl_path={{ supervisor_ctl }} supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }} config={{ supervisor_cfg }}
state=restarted state=restarted
when: edxapp_installed is defined and celery_worker is defined and not devstack when: start_services and edxapp_installed is defined and celery_worker is defined and not devstack
with_items: edxapp_workers with_items: edxapp_workers
sudo_user: "{{ common_web_user }}" sudo_user: "{{ common_web_user }}"
...@@ -274,7 +274,7 @@ ...@@ -274,7 +274,7 @@
register: supervisor_update register: supervisor_update
sudo_user: "{{ supervisor_service_user }}" sudo_user: "{{ supervisor_service_user }}"
changed_when: supervisor_update.stdout != "" changed_when: supervisor_update.stdout != ""
when: not devstack when: start_services and not devstack
- name: edxapp | ensure edxapp has started - name: edxapp | ensure edxapp has started
supervisorctl_local: > supervisorctl_local: >
...@@ -283,7 +283,7 @@ ...@@ -283,7 +283,7 @@
config={{ supervisor_cfg }} config={{ supervisor_cfg }}
name="edxapp:{{ item }}" name="edxapp:{{ item }}"
sudo_user: "{{ supervisor_service_user }}" sudo_user: "{{ supervisor_service_user }}"
when: celery_worker is not defined and not devstack when: start_services and celery_worker is not defined and not devstack
with_items: service_variants_enabled with_items: service_variants_enabled
- name: edxapp | ensure edxapp_workers has started - name: edxapp | ensure edxapp_workers has started
...@@ -292,7 +292,7 @@ ...@@ -292,7 +292,7 @@
supervisorctl_path={{ supervisor_ctl }} supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }} config={{ supervisor_cfg }}
state=started state=started
when: celery_worker is defined and not devstack when: start_services and celery_worker is defined and not devstack
with_items: edxapp_workers with_items: edxapp_workers
sudo_user: "{{ supervisor_service_user }}" sudo_user: "{{ supervisor_service_user }}"
......
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
supervisorctl_path={{ supervisor_ctl }} supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }} config={{ supervisor_cfg }}
state=restarted state=restarted
when: forum_installed is defined and not devstack when: start_services and forum_installed is defined and not devstack
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update" shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update"
register: supervisor_update register: supervisor_update
changed_when: supervisor_update.stdout != "" changed_when: supervisor_update.stdout != ""
when: not devstack when: start_services and not devstack
- name: forum | ensure forum is started - name: forum | ensure forum is started
supervisorctl_local: > supervisorctl_local: >
...@@ -49,6 +49,9 @@ ...@@ -49,6 +49,9 @@
supervisorctl_path={{ supervisor_ctl }} supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }} config={{ supervisor_cfg }}
state=started state=started
when: not devstack when: start_services and not devstack
- include: test.yml tags=deploy
when: start_services
- set_fact: forum_installed=true - set_fact: forum_installed=true
...@@ -112,3 +112,8 @@ ...@@ -112,3 +112,8 @@
# any reason, this will ensure that it is started up again. # any reason, this will ensure that it is started up again.
- name: nginx | make sure nginx has started - name: nginx | make sure nginx has started
service: name=nginx state=started service: name=nginx state=started
when: start_services
- name: nginx | make sure nginx has stopped
service: name=nginx state=stopped
when: not start_services
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
supervisorctl_path={{ supervisor_ctl }} supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }} config={{ supervisor_cfg }}
state=restarted state=restarted
when: not devstack when: start_services and ora_installed is defined and not devstack
- name: ora | restart ora_celery - name: ora | restart ora_celery
supervisorctl_local: > supervisorctl_local: >
...@@ -13,4 +13,4 @@ ...@@ -13,4 +13,4 @@
supervisorctl_path={{ supervisor_ctl }} supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }} config={{ supervisor_cfg }}
state=restarted state=restarted
when: not devstack when: start_services and ora_installed is defined and not devstack
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
- name: ora | update supervisor configuration - name: ora | update supervisor configuration
shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update" shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update"
register: supervisor_update register: supervisor_update
when: not devstack when: start_services and not devstack
changed_when: supervisor_update.stdout != "" changed_when: supervisor_update.stdout != ""
- name: ora | ensure ora is started - name: ora | ensure ora is started
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
supervisorctl_path={{ supervisor_ctl }} supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }} config={{ supervisor_cfg }}
state=started state=started
when: not devstack when: start_services and not devstack
- name: ora | ensure ora_celery is started - name: ora | ensure ora_celery is started
supervisorctl_local: > supervisorctl_local: >
...@@ -103,4 +103,6 @@ ...@@ -103,4 +103,6 @@
supervisorctl_path={{ supervisor_ctl }} supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }} config={{ supervisor_cfg }}
state=started state=started
when: not devstack when: start_services and not devstack
- set_fact: ora_installed=true
...@@ -103,3 +103,7 @@ ...@@ -103,3 +103,7 @@
file: > file: >
path=/usr/local/bin/rabbitmqadmin owner=root path=/usr/local/bin/rabbitmqadmin owner=root
group=root mode=0655 group=root mode=0655
- name: rabbitmq | stop rabbit nodes
service: name=rabbitmq-server state=restarted
when: not start_services
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
supervisorctl_path={{ supervisor_ctl }} supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }} config={{ supervisor_cfg }}
state=restarted state=restarted
when: start_services and xqueue_installed is defined
with_items: with_items:
- xqueue - xqueue
- xqueue_consumer - xqueue_consumer
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update" shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update"
register: supervisor_update register: supervisor_update
changed_when: supervisor_update.stdout != "" changed_when: supervisor_update.stdout != ""
when: start_services
- name: xqueue | ensure xqueue, consumer is running - name: xqueue | ensure xqueue, consumer is running
supervisorctl_local: > supervisorctl_local: >
...@@ -70,6 +71,9 @@ ...@@ -70,6 +71,9 @@
supervisorctl_path={{ supervisor_ctl }} supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }} config={{ supervisor_cfg }}
state=started state=started
when: start_services
with_items: with_items:
- xqueue - xqueue
- xqueue_consumer - xqueue_consumer
- set_fact: xqueue_installed=true
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
- name: xserver | update supervisor configuration - name: xserver | update supervisor configuration
shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update" shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update"
register: supervisor_update register: supervisor_update
when: start_services
changed_when: supervisor_update.stdout != "" changed_when: supervisor_update.stdout != ""
- name: xserver | ensure xserver is started - name: xserver | ensure xserver is started
...@@ -62,6 +63,7 @@ ...@@ -62,6 +63,7 @@
supervisorctl_path={{ supervisor_ctl }} supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }} config={{ supervisor_cfg }}
state=started state=started
when: start_services
- name: xserver | create a symlink for venv python - name: xserver | create a symlink for venv python
file: > file: >
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment