Commit 8ced6f37 by Kevin Falcone

Move deploy file into the main tasks

parent dad85c04
---
- 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
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: setup the app env file
template:
src: "xqueue_env.j2"
dest: "{{ xqueue_app_dir }}/xqueue_env"
owner: "{{ xqueue_user }}"
group: "{{ common_web_group }}"
mode: 0644
tags:
- install
- install:configuration
# Install the python requirements into {{ xqueue_venv_dir }}
- name: "Install python requirements"
pip:
requirements: "{{ xqueue_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
# If this is an openstack deployment, install openstack requirements
- name: Install python openstack requirements
pip:
requirements: "{{ xqueue_openstack_requirements_file }}"
virtualenv: "{{ xqueue_venv_dir }}"
state: present
extra_args: "-i {{ COMMON_PYPI_MIRROR_URL }} --exists-action w"
become_user: "{{ xqueue_user }}"
when: XQUEUE_SETTINGS == 'openstack_settings'
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: "{{ xqueue_venv_bin }}/django-admin.py migrate --noinput --settings=xqueue.{{ XQUEUE_SETTINGS }} --pythonpath={{ xqueue_code_dir }}"
become_user: "{{ xqueue_user }}"
environment:
DB_MIGRATION_USER: "{{ COMMON_MYSQL_MIGRATE_USER }}"
DB_MIGRATION_PASS: "{{ COMMON_MYSQL_MIGRATE_PASS }}"
when: migrate_db is defined and migrate_db|lower == "yes" and COMMON_MYSQL_MIGRATE_PASS
run_once: yes
tags:
- migrate
- migrate:db
- name: Create users
shell: "SERVICE_VARIANT=xqueue {{ xqueue_venv_bin }}/django-admin.py update_users --settings=xqueue.{{ XQUEUE_SETTINGS }} --pythonpath={{ xqueue_code_dir }}"
become_user: "{{ xqueue_user }}"
when: not disable_edx_services
tags:
- manage
- manage:app-users
# call supervisorctl update. this reloads
# the supervisorctl config and restarts
# the services if any of the configurations
# have changed.
#
- name: Update 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: Ensure xqueue, consumer is running
supervisorctl:
name: "{{ item }}"
supervisorctl_path: "{{ supervisor_ctl }}"
config: "{{ supervisor_cfg }}"
state: started
with_items:
- xqueue
- xqueue_consumer
when: not disable_edx_services
tags:
- manage
- manage:start
- name: Create a symlink for venv commands
file:
src: "{{ xqueue_venv_bin }}/{{ item }}"
dest: "{{ COMMON_BIN_DIR }}/{{ item }}.xqueue"
state: link
with_items:
- python
- pip
tags:
- install
- install:app-requirements
- name: Create symlinks for repo commands
file:
src: "{{ xqueue_code_dir }}/{{ item }}"
dest: "{{ COMMON_BIN_DIR }}/{{ item.split('.')[0] }}.xqueue"
state: link
with_items:
- manage.py
tags:
- install
- install:app-requirements
- name: Restart xqueue
supervisorctl:
name: "{{ item }}"
supervisorctl_path: "{{ supervisor_ctl }}"
config: "{{ supervisor_cfg }}"
state: restarted
when: not disable_edx_services
with_items:
- xqueue
- xqueue_consumer
tags:
- manage
- manage:start
......@@ -11,7 +11,162 @@
- devstack
- devstack:install
- 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
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: setup the app env file
template:
src: "xqueue_env.j2"
dest: "{{ xqueue_app_dir }}/xqueue_env"
owner: "{{ xqueue_user }}"
group: "{{ common_web_group }}"
mode: 0644
tags:
- install
- install:configuration
# Install the python requirements into {{ xqueue_venv_dir }}
- name: "Install python requirements"
pip:
requirements: "{{ xqueue_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
# If this is an openstack deployment, install openstack requirements
- name: Install python openstack requirements
pip:
requirements: "{{ xqueue_openstack_requirements_file }}"
virtualenv: "{{ xqueue_venv_dir }}"
state: present
extra_args: "-i {{ COMMON_PYPI_MIRROR_URL }} --exists-action w"
become_user: "{{ xqueue_user }}"
when: XQUEUE_SETTINGS == 'openstack_settings'
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: "{{ xqueue_venv_bin }}/django-admin.py migrate --noinput --settings=xqueue.{{ XQUEUE_SETTINGS }} --pythonpath={{ xqueue_code_dir }}"
become_user: "{{ xqueue_user }}"
environment:
DB_MIGRATION_USER: "{{ COMMON_MYSQL_MIGRATE_USER }}"
DB_MIGRATION_PASS: "{{ COMMON_MYSQL_MIGRATE_PASS }}"
when: migrate_db is defined and migrate_db|lower == "yes" and COMMON_MYSQL_MIGRATE_PASS
run_once: yes
tags:
- migrate
- migrate:db
- name: Create users
shell: "SERVICE_VARIANT=xqueue {{ xqueue_venv_bin }}/django-admin.py update_users --settings=xqueue.{{ XQUEUE_SETTINGS }} --pythonpath={{ xqueue_code_dir }}"
become_user: "{{ xqueue_user }}"
when: not disable_edx_services
tags:
- manage
- manage:app-users
# call supervisorctl update. this reloads
# the supervisorctl config and restarts
# the services if any of the configurations
# have changed.
#
- name: Update 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: Ensure xqueue, consumer is running
supervisorctl:
name: "{{ item }}"
supervisorctl_path: "{{ supervisor_ctl }}"
config: "{{ supervisor_cfg }}"
state: started
with_items:
- xqueue
- xqueue_consumer
when: not disable_edx_services
tags:
- manage
- manage:start
- name: Create a symlink for venv commands
file:
src: "{{ xqueue_venv_bin }}/{{ item }}"
dest: "{{ COMMON_BIN_DIR }}/{{ item }}.xqueue"
state: link
with_items:
- python
- pip
tags:
- install
- install:app-requirements
- name: Create symlinks for repo commands
file:
src: "{{ xqueue_code_dir }}/{{ item }}"
dest: "{{ COMMON_BIN_DIR }}/{{ item.split('.')[0] }}.xqueue"
state: link
with_items:
- manage.py
tags:
- install
- install:app-requirements
- include: deploy.yml
- name: Restart xqueue
supervisorctl:
name: "{{ item }}"
supervisorctl_path: "{{ supervisor_ctl }}"
config: "{{ supervisor_cfg }}"
state: restarted
when: not disable_edx_services
with_items:
- xqueue
- xqueue_consumer
tags:
- deploy
- manage
- manage:start
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