Commit 0b0ca78a by arbabnazar Committed by Edward Zarecor

modified the tasks

parent 92f7ec9a
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
# #
# #
# #
# Tasks for role course_discovery # Tasks for role discovery
# #
# Overview: # Overview:
# #
...@@ -23,9 +23,9 @@ ...@@ -23,9 +23,9 @@
- name: add gunicorn configuration file - name: add gunicorn configuration file
template: template:
src: edx/app/course_discovery/course_discovery_gunicorn.py.j2 src: edx/app/discovery/discovery_gunicorn.py.j2
dest: "{{ course_discovery_home }}/course_discovery_gunicorn.py" dest: "{{ discovery_home }}/discovery_gunicorn.py"
sudo_user: "{{ course_discovery_user }}" sudo_user: "{{ discovery_user }}"
tags: tags:
- install - install
- install:configuration - install:configuration
...@@ -38,7 +38,8 @@ ...@@ -38,7 +38,8 @@
- install:system-requirements - install:system-requirements
- name: install python3.5 - name: install python3.5
apt: pkg={{ item }} apt:
name: "{{ item }}"
with_items: with_items:
- python3.5 - python3.5
- python3.5-dev - python3.5-dev
...@@ -47,10 +48,10 @@ ...@@ -47,10 +48,10 @@
- install:system-requirements - install:system-requirements
- name: build virtualenv - name: build virtualenv
command: "virtualenv --python=python3.5 {{ course_discovery_venv_dir }}" command: "virtualenv --python=python3.5 {{ discovery_venv_dir }}"
args: args:
creates: "{{ course_discovery_venv_dir }}/bin/pip" creates: "{{ discovery_venv_dir }}/bin/pip"
sudo_user: "{{ course_discovery_user }}" sudo_user: "{{ discovery_user }}"
tags: tags:
- install - install
- install:system-requirements - install:system-requirements
...@@ -58,9 +59,9 @@ ...@@ -58,9 +59,9 @@
- name: install application requirements - name: install application requirements
command: make requirements command: make requirements
args: args:
chdir: "{{ course_discovery_code_dir }}" chdir: "{{ discovery_code_dir }}"
sudo_user: "{{ course_discovery_user }}" sudo_user: "{{ discovery_user }}"
environment: "{{ course_discovery_environment }}" environment: "{{ discovery_environment }}"
tags: tags:
- install - install
- install:app-requirements - install:app-requirements
...@@ -68,17 +69,17 @@ ...@@ -68,17 +69,17 @@
- name: install development requirements - name: install development requirements
command: make local-requirements command: make local-requirements
args: args:
chdir: "{{ course_discovery_code_dir }}" chdir: "{{ discovery_code_dir }}"
sudo_user: "{{ course_discovery_user }}" sudo_user: "{{ discovery_user }}"
environment: "{{ course_discovery_environment }}" environment: "{{ discovery_environment }}"
tags: tags:
- devstack - devstack
- devstack:install - devstack:install
- name: wait for database - name: wait for database
wait_for: wait_for:
host: "{{ COURSE_DISCOVERY_DATABASES.default.HOST }}" host: "{{ DISCOVERY_DATABASES.default.HOST }}"
port: "{{ COURSE_DISCOVERY_DATABASES.default.PORT }}" port: "{{ DISCOVERY_DATABASES.default.PORT }}"
delay: 2 delay: 2
tags: tags:
- migrate - migrate
...@@ -86,10 +87,10 @@ ...@@ -86,10 +87,10 @@
- name: create databases - name: create databases
mysql_db: mysql_db:
login_host: "{{ COURSE_DISCOVERY_DATABASES.default.HOST }}" login_host: "{{ DISCOVERY_DATABASES.default.HOST }}"
login_user: "{{ COURSE_DISCOVERY_DB_ADMIN_USER }}" login_user: "{{ DISCOVERY_DB_ADMIN_USER }}"
login_password: "{{ COURSE_DISCOVERY_DB_ADMIN_PASSWORD }}" login_password: "{{ DISCOVERY_DB_ADMIN_PASSWORD }}"
db: "{{ COURSE_DISCOVERY_DEFAULT_DB_NAME }}" db: "{{ DISCOVERY_DEFAULT_DB_NAME }}"
state: present state: present
encoding: utf8 encoding: utf8
tags: tags:
...@@ -98,16 +99,16 @@ ...@@ -98,16 +99,16 @@
- name: create database users - name: create database users
mysql_user: mysql_user:
login_host: "{{ COURSE_DISCOVERY_DATABASES.default.HOST }}" login_host: "{{ DISCOVERY_DATABASES.default.HOST }}"
login_user: "{{ COURSE_DISCOVERY_DB_ADMIN_USER }}" login_user: "{{ DISCOVERY_DB_ADMIN_USER }}"
login_password: "{{ COURSE_DISCOVERY_DB_ADMIN_PASSWORD }}" login_password: "{{ DISCOVERY_DB_ADMIN_PASSWORD }}"
name: "{{ item.name }}" name: "{{ item.name }}"
host: "{{ DISCOVERY_MYSQL_MATCHER }}" host: "{{ DISCOVERY_MYSQL_MATCHER }}"
password: "{{ item.password }}" password: "{{ item.password }}"
priv: "{{ COURSE_DISCOVERY_DEFAULT_DB_NAME }}.*:ALL" priv: "{{ DISCOVERY_DEFAULT_DB_NAME }}.*:ALL"
with_items: with_items:
- name: "{{ COURSE_DISCOVERY_DATABASES.default.USER }}" - name: "{{ DISCOVERY_DATABASES.default.USER }}"
password: "{{ COURSE_DISCOVERY_DATABASES.default.PASSWORD }}" password: "{{ DISCOVERY_DATABASES.default.PASSWORD }}"
- name: "{{ COMMON_MYSQL_MIGRATE_USER }}" - name: "{{ COMMON_MYSQL_MIGRATE_USER }}"
password: "{{ COMMON_MYSQL_MIGRATE_PASS }}" password: "{{ COMMON_MYSQL_MIGRATE_PASS }}"
tags: tags:
...@@ -117,9 +118,9 @@ ...@@ -117,9 +118,9 @@
- name: migrate database - name: migrate database
command: make migrate command: make migrate
args: args:
chdir: "{{ course_discovery_code_dir }}" chdir: "{{ discovery_code_dir }}"
sudo_user: "{{ course_discovery_user }}" sudo_user: "{{ discovery_user }}"
environment: "{{ course_discovery_migration_environment }}" environment: "{{ discovery_migration_environment }}"
when: migrate_db is defined and migrate_db|lower == "yes" when: migrate_db is defined and migrate_db|lower == "yes"
tags: tags:
- migrate - migrate
...@@ -127,8 +128,8 @@ ...@@ -127,8 +128,8 @@
- name: write out the supervisor wrapper - name: write out the supervisor wrapper
template: template:
src: "edx/app/course_discovery/course_discovery.sh.j2" src: "edx/app/discovery/discovery.sh.j2"
dest: "{{ course_discovery_home }}/{{ course_discovery_service_name }}.sh" dest: "{{ discovery_home }}/{{ discovery_service_name }}.sh"
mode: 0650 mode: 0650
owner: "{{ supervisor_user }}" owner: "{{ supervisor_user }}"
group: "{{ common_web_user }}" group: "{{ common_web_user }}"
...@@ -138,8 +139,8 @@ ...@@ -138,8 +139,8 @@
- name: write supervisord config - name: write supervisord config
template: template:
src: "edx/app/supervisor/conf.d.available/course_discovery.conf.j2" src: "edx/app/supervisor/conf.d.available/discovery.conf.j2"
dest: "{{ supervisor_available_dir }}/{{ course_discovery_service_name }}.conf" dest: "{{ supervisor_available_dir }}/{{ discovery_service_name }}.conf"
owner: "{{ supervisor_user }}" owner: "{{ supervisor_user }}"
group: "{{ common_web_user }}" group: "{{ common_web_user }}"
mode: 0644 mode: 0644
...@@ -149,8 +150,8 @@ ...@@ -149,8 +150,8 @@
- name: write devstack script - name: write devstack script
template: template:
src: "edx/app/course_discovery/devstack.sh.j2" src: "edx/app/discovery/devstack.sh.j2"
dest: "{{ course_discovery_home }}/devstack.sh" dest: "{{ discovery_home }}/devstack.sh"
owner: "{{ supervisor_user }}" owner: "{{ supervisor_user }}"
group: "{{ common_web_user }}" group: "{{ common_web_user }}"
mode: 0744 mode: 0744
...@@ -158,12 +159,12 @@ ...@@ -158,12 +159,12 @@
- devstack - devstack
- devstack:install - devstack:install
- name: setup the course_discovery env file - name: setup the discovery env file
template: template:
src: "./{{ course_discovery_home }}/{{ course_discovery_service_name }}_env.j2" src: "./{{ discovery_home }}/{{ discovery_service_name }}_env.j2"
dest: "{{ course_discovery_home }}/course_discovery_env" dest: "{{ discovery_home }}/discovery_env"
owner: "{{ course_discovery_user }}" owner: "{{ discovery_user }}"
group: "{{ course_discovery_user }}" group: "{{ discovery_user }}"
mode: 0644 mode: 0644
tags: tags:
- install - install
...@@ -171,8 +172,8 @@ ...@@ -171,8 +172,8 @@
- name: enable supervisor script - name: enable supervisor script
file: file:
src: "{{ supervisor_available_dir }}/{{ course_discovery_service_name }}.conf" src: "{{ supervisor_available_dir }}/{{ discovery_service_name }}.conf"
dest: "{{ supervisor_cfg_dir }}/{{ course_discovery_service_name }}.conf" dest: "{{ supervisor_cfg_dir }}/{{ discovery_service_name }}.conf"
state: link state: link
force: yes force: yes
when: not disable_edx_services when: not disable_edx_services
...@@ -189,8 +190,8 @@ ...@@ -189,8 +190,8 @@
- name: create symlinks from the venv bin dir - name: create symlinks from the venv bin dir
file: file:
src: "{{ course_discovery_venv_dir }}/bin/{{ item }}" src: "{{ discovery_venv_dir }}/bin/{{ item }}"
dest: "{{ COMMON_BIN_DIR }}/{{ item.split('.')[0] }}.course_discovery" dest: "{{ COMMON_BIN_DIR }}/{{ item.split('.')[0] }}.discovery"
state: link state: link
with_items: with_items:
- python - python
...@@ -202,8 +203,8 @@ ...@@ -202,8 +203,8 @@
- name: create symlinks from the repo dir - name: create symlinks from the repo dir
file: file:
src: "{{ course_discovery_code_dir }}/{{ item }}" src: "{{ discovery_code_dir }}/{{ item }}"
dest: "{{ COMMON_BIN_DIR }}/{{ item.split('.')[0] }}.course_discovery" dest: "{{ COMMON_BIN_DIR }}/{{ item.split('.')[0] }}.discovery"
state: link state: link
with_items: with_items:
- manage.py - manage.py
...@@ -214,9 +215,9 @@ ...@@ -214,9 +215,9 @@
- name: run collectstatic - name: run collectstatic
command: make static command: make static
args: args:
chdir: "{{ course_discovery_code_dir }}" chdir: "{{ discovery_code_dir }}"
sudo_user: "{{ course_discovery_user }}" sudo_user: "{{ discovery_user }}"
environment: "{{ course_discovery_environment }}" environment: "{{ discovery_environment }}"
tags: tags:
- assets - assets
- assets:gather - assets:gather
...@@ -226,28 +227,32 @@ ...@@ -226,28 +227,32 @@
state: restarted state: restarted
supervisorctl_path: "{{ supervisor_ctl }}" supervisorctl_path: "{{ supervisor_ctl }}"
config: "{{ supervisor_cfg }}" config: "{{ supervisor_cfg }}"
name: "{{ course_discovery_service_name }}" name: "{{ discovery_service_name }}"
when: not disable_edx_services when: not disable_edx_services
sudo_user: "{{ supervisor_service_user }}" sudo_user: "{{ supervisor_service_user }}"
tags: tags:
- manage - manage
- manage:start - manage:start
- name: Copying nginx configs for course_discovery - name: Copying nginx configs for discovery
template: > template:
src=edx/app/nginx/sites-available/course_discovery.j2 src: "edx/app/nginx/sites-available/discovery.j2"
dest={{ nginx_sites_available_dir }}/course_discovery dest: "{{ nginx_sites_available_dir }}/discovery"
owner=root group={{ common_web_user }} mode=0640 owner: root
group: "{{ common_web_user }}"
mode: 0640
notify: reload nginx notify: reload nginx
tags: tags:
- install - install
- install:vhosts - install:vhosts
- name: Creating nginx config links for course_discovery - name: Creating nginx config links for discovery
file: > file:
src={{ nginx_sites_available_dir }}/course_discovery src: "{{ nginx_sites_available_dir }}/discovery"
dest={{ nginx_sites_enabled_dir }}/course_discovery dest: "{{ nginx_sites_enabled_dir }}/discovery"
state=link owner=root group=root state: link
owner: root
group: root
notify: reload nginx notify: reload nginx
tags: tags:
- install - install
......
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