use YAML syntax for ansible tasks

parent a2ce7bd7
......@@ -19,26 +19,44 @@
#
#
- name: stop supervisor
service: name=supervisor state=stopped arguments="{{ STOP_ALL_EDX_SERVICES_EXTRA_ARGS }}"
service:
name: supervisor
state: stopped
arguments: "{{ STOP_ALL_EDX_SERVICES_EXTRA_ARGS }}"
- name: stop nginx
service: name=nginx state=stopped arguments="{{ STOP_ALL_EDX_SERVICES_EXTRA_ARGS }}"
service:
name: nginx
state: stopped
arguments: "{{ STOP_ALL_EDX_SERVICES_EXTRA_ARGS }}"
- name: stop rabbitmq-server
service: name=rabbitmq-server state=stopped arguments="{{ STOP_ALL_EDX_SERVICES_EXTRA_ARGS }}"
service:
name: rabbitmq-server
state: stopped
arguments: "{{ STOP_ALL_EDX_SERVICES_EXTRA_ARGS }}"
- name: stop mysql
service: name=mysql state=stopped arguments="{{ STOP_ALL_EDX_SERVICES_EXTRA_ARGS }}"
service:
name: mysql
state: stopped
arguments: "{{ STOP_ALL_EDX_SERVICES_EXTRA_ARGS }}"
- name: stop memcached
service: name=memcached state=stopped arguments="{{ STOP_ALL_EDX_SERVICES_EXTRA_ARGS }}"
service:
name: memcached
state: stopped
arguments: "{{ STOP_ALL_EDX_SERVICES_EXTRA_ARGS }}"
- name: stop mongodb
service: name=mongodb state=stopped arguments="{{ STOP_ALL_EDX_SERVICES_EXTRA_ARGS }}"
service:
name: mongodb
state: stopped
arguments: "{{ STOP_ALL_EDX_SERVICES_EXTRA_ARGS }}"
# Celery and Supervisord should not be killed because they may have long running tasks that need to finish
- name: kill processes by user
shell: pgrep -u {{ item }} -lf | grep -v celery | grep -v supervisord | grep -v gunicorn | awk '{ print $1}' | xargs -I {} kill {} || true
with_items:
- www-data
- rabbitmq
- www-data
- rabbitmq
......@@ -22,35 +22,45 @@
# - stop_all_edx_services
#
#
- name: stop supervisor
stat: path=/etc/init/supervisor.conf
- name: Stop supervisor
stat:
path: /etc/init/supervisor.conf
register: stat_out
changed_when: stat_out is defined and stat_out.stat.exists
notify: stop supervisor
notify:
- stop supervisor
- name: stop nginx
stat: path=/etc/init.d/nginx
- name: Stop nginx
stat:
path: /etc/init.d/nginx
register: stat_out
changed_when: stat_out is defined and stat_out.stat.exists
notify: stop nginx
notify:
- stop nginx
- name: stop rabbitmq-server
stat: path=/etc/init.d/rabbitmq-server
- name: Stop rabbitmq-server
stat:
path: /etc/init.d/rabbitmq-server
register: stat_out
changed_when: stat_out is defined and stat_out.stat.exists
notify: stop rabbitmq-server
notify:
- stop rabbitmq-server
- name: stop memcached
stat: path=/etc/init.d/memcached
- name: Stop memcached
stat:
path: /etc/init.d/memcached
register: stat_out
changed_when: stat_out is defined and stat_out.stat.exists
notify: stop memcached
notify:
- stop memcached
- name: stop mongodb
stat: path=/etc/init.d/mongodb
- name: Stop mongodb
stat:
path: /etc/init.d/mongodb
register: stat_out
changed_when: stat_out is defined and stat_out.stat.exists
notify: stop mongodb
notify:
- stop mongodb
- shell: "true"
notify: kill processes by user
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