Commit 7c2b0f9a by Arbab Nazar

Merge pull request #3079 from edx/arbab/rewrite-service-variant

use the YAML style parameter passing instead of old style module calls
parents 227a36ed 530ee8a9
- name: "create {{ item }} application config"
template: >
src={{ item }}.env.json.j2
dest={{ edxapp_app_dir }}/{{ item }}.env.json
---
- name: create application and auth config
template:
src: "{{ item[0] }}.{{ item[1] }}.json.j2"
dest: "{{ edxapp_app_dir }}/{{ item[0] }}.{{ item[1] }}.json"
sudo_user: "{{ edxapp_user }}"
with_items: service_variants_enabled
with_nested:
- "{{ service_variants_enabled }}"
- [ 'env', 'auth' ]
tags:
- install
- install:configuration
- edxapp_cfg
- name: "create {{ item }} auth file"
template: >
src={{ item }}.auth.json.j2
dest={{ edxapp_app_dir }}/{{ item }}.auth.json
- name: create auth and application yaml config
template:
src: "{{ item[0] }}.{{ item[1] }}.yaml.j2"
dest: "{{ EDXAPP_CFG_DIR }}/{{ item[0] }}.{{ item[1] }}.yaml"
sudo_user: "{{ edxapp_user }}"
with_items: service_variants_enabled
tags:
- install
- install:configuration
- edxapp_cfg
- name: "create {{ item }} yaml application config"
template: >
src={{ item }}.env.yaml.j2
dest={{ EDXAPP_CFG_DIR }}/{{ item }}.env.yaml
sudo_user: "{{ edxapp_user }}"
with_items: service_variants_enabled
tags:
- install
- install:configuration
- edxapp_cfg
- name: "create {{ item }} yaml auth file"
template: >
src={{ item }}.auth.yaml.j2
dest={{ EDXAPP_CFG_DIR }}/{{ item }}.auth.yaml
sudo_user: "{{ edxapp_user }}"
with_items: service_variants_enabled
with_nested:
- "{{ service_variants_enabled }}"
- [ 'env', 'auth' ]
tags:
- install
- install:configuration
- edxapp_cfg
# write the supervisor scripts for the service variants
- name: "writing {{ item }} supervisor script"
template: >
src={{ item }}.conf.j2 dest={{ supervisor_available_dir }}/{{ item }}.conf
owner={{ supervisor_user }}
group={{ supervisor_user }}
with_items: service_variants_enabled
template:
src: "{{ item }}.conf.j2"
dest: "{{ supervisor_available_dir }}/{{ item }}.conf"
owner: "{{ supervisor_user }}"
group: "{{ supervisor_user }}"
sudo_user: "{{ supervisor_user }}"
with_items: "{{ service_variants_enabled }}"
tags:
- install
- install:configuration
- name: writing edxapp supervisor script
template: >
src=edxapp.conf.j2 dest={{ supervisor_available_dir }}/edxapp.conf
owner={{ supervisor_user }}
group={{ supervisor_user }}
# write the supervisor script for edxapp and celery workers
- name: writing edxapp and celery supervisor scripts
template:
src: "{{ item }}.j2"
dest: "{{ supervisor_available_dir }}/{{ item }}"
owner: "{{ supervisor_user }}"
group: "{{ supervisor_user }}"
sudo_user: "{{ supervisor_user }}"
with_items:
- edxapp.conf
- workers.conf
tags:
- install
- install:configuration
- name: "add gunicorn configuration files"
template: >
src={{ item }}_gunicorn.py.j2 dest={{ edxapp_app_dir }}/{{ item }}_gunicorn.py
with_items: service_variants_enabled
- name: add gunicorn configuration files
template:
src: "{{ item }}_gunicorn.py.j2"
dest: "{{ edxapp_app_dir }}/{{ item }}_gunicorn.py"
sudo_user: "{{ edxapp_user }}"
tags:
- install
- install:configuration
# write the supervisor script for celery workers
- name: writing celery worker supervisor script
template: >
src=workers.conf.j2 dest={{ supervisor_available_dir }}/workers.conf
owner={{ supervisor_user }}
group={{ supervisor_user }}
sudo_user: "{{ supervisor_user }}"
with_items: "{{ service_variants_enabled }}"
tags:
- install
- install:configuration
# Enable the supervisor jobs
- name: "enable {{ item }} supervisor script"
file: >
src={{ supervisor_available_dir }}/{{ item }}.conf
dest={{ supervisor_cfg_dir }}/{{ item }}.conf
state=link
force=yes
with_items: service_variants_enabled
when: celery_worker is not defined and not disable_edx_services
file:
src: "{{ supervisor_available_dir }}/{{ item }}.conf"
dest: "{{ supervisor_cfg_dir }}/{{ item }}.conf"
state: link
force: yes
sudo_user: "{{ supervisor_user }}"
with_items: "{{ service_variants_enabled }}"
when: celery_worker is not defined and not disable_edx_services
tags:
- install
- install:configuration
- name: "enable edxapp supervisor script"
file: >
src={{ supervisor_available_dir }}/edxapp.conf
dest={{ supervisor_cfg_dir }}/edxapp.conf
state=link
force=yes
when: celery_worker is not defined and not disable_edx_services
- name: enable edxapp supervisor script
file:
src: "{{ supervisor_available_dir }}/edxapp.conf"
dest: "{{ supervisor_cfg_dir }}/edxapp.conf"
state: link
force: yes
sudo_user: "{{ supervisor_user }}"
when: celery_worker is not defined and not disable_edx_services
tags:
- install
- install:configuration
- name: "enable celery worker supervisor script"
file: >
src={{ supervisor_available_dir }}/workers.conf
dest={{ supervisor_cfg_dir }}/workers.conf
state=link
force=yes
when: celery_worker is defined and not disable_edx_services
- name: enable celery worker supervisor script
file:
src: "{{ supervisor_available_dir }}/workers.conf"
dest: "{{ supervisor_cfg_dir }}/workers.conf"
state: link
force: yes
sudo_user: "{{ supervisor_user }}"
when: celery_worker is defined and not disable_edx_services
tags:
- install
- install:configuration
- name: create helper scripts for managing edxapp
template: >
src=edx/bin/{{ item[0] }}-{{ item[1] }}.j2
dest={{ COMMON_BIN_DIR }}/{{ item[0] }}-{{ item[1] }}
owner={{ edxapp_user }}
mode=0755
template:
src: "edx/bin/{{ item[0] }}-{{ item[1] }}.j2"
dest: "{{ COMMON_BIN_DIR }}/{{ item[0] }}-{{ item[1] }}"
owner: "{{ edxapp_user }}"
mode: 0755
with_nested:
- edxapp_helper_scripts
- service_variants_enabled
- "{{ edxapp_helper_scripts }}"
- "{{ service_variants_enabled }}"
tags:
- install
- install:configuration
......@@ -145,16 +122,15 @@
DB_MIGRATION_USER: "{{ COMMON_MYSQL_MIGRATE_USER }}"
DB_MIGRATION_PASS: "{{ COMMON_MYSQL_MIGRATE_PASS }}"
EDX_PLATFORM_SETTINGS_OVERRIDE: "aws_migrate"
with_items: service_variants_enabled
with_items: "{{ service_variants_enabled }}"
tags:
- migrate
# Gather assets using paver if possible
- name: gather {{ item }} static assets with paver
- name: "gather {{ item }} static assets with paver"
command: "{{ COMMON_BIN_DIR }}/edxapp-update-assets-{{ item }}"
when: celery_worker is not defined and not devstack and item != "lms-preview"
with_items: service_variants_enabled
with_items: "{{ service_variants_enabled }}"
tags:
- gather_static_assets
- assets
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