Commit 8caa685c by Feanil Patel

We don't need to do multi-line strings for ansible anymore.

The newer version of ansible supports sub dictionaries for module parameters.
parent 266fffa5
...@@ -15,16 +15,16 @@ ...@@ -15,16 +15,16 @@
# #
- name: add gunicorn configuration file - name: add gunicorn configuration file
template: > template:
src=edx/app/{{ role_name }}/{{ role_name }}_gunicorn.py.j2 src: edx/app/{{ role_name }}/{{ role_name }}_gunicorn.py.j2
dest={{ '{{' }} {{ role_name }}_home }}/{{ role_name }}_gunicorn.py dest: {{ '{{' }} {{ role_name }}_home }}/{{ role_name }}_gunicorn.py
sudo_user: "{{ '{{' }} {{ role_name }}_user }}" sudo_user: "{{ '{{' }} {{ role_name }}_user }}"
- name: install application requirements - name: install application requirements
pip: > pip:
requirements="{{ '{{' }} {{ role_name }}_requirements_base }}/{{ '{{' }} item }}" requirements: "{{ '{{' }} {{ role_name }}_requirements_base }}/{{ '{{' }} item }}"
virtualenv="{{ '{{' }} {{ role_name }}_home }}/venvs/{{ '{{' }} {{ role_name }}_service_name }}" virtualenv: "{{ '{{' }} {{ role_name }}_home }}/venvs/{{ '{{' }} {{ role_name }}_service_name }}"
state=present state: present
sudo_user: "{{ '{{' }} {{ role_name }}_user }}" sudo_user: "{{ '{{' }} {{ role_name }}_user }}"
with_items: {{ '{{' }} role_name }}_requirements with_items: {{ '{{' }} role_name }}_requirements
...@@ -39,31 +39,35 @@ ...@@ -39,31 +39,35 @@
when: migrate_db is defined and migrate_db|lower == "yes" when: migrate_db is defined and migrate_db|lower == "yes"
- name: write out the supervisor wrapper - name: write out the supervisor wrapper
template: > template:
src=edx/app/{{ role_name }}/{{ role_name }}.sh.j2 src: edx/app/{{ role_name }}/{{ role_name }}.sh.j2
dest={{ '{{' }} {{ role_name }}_home }}/{{ '{{' }} {{ role_name }}_service_name }}.sh dest: {{ '{{' }} {{ role_name }}_home }}/{{ '{{' }} {{ role_name }}_service_name }}.sh
mode=0650 owner={{ '{{' }} supervisor_user }} group={{ '{{' }} common_web_user }} mode: 0650
owner: {{ '{{' }} supervisor_user }}
group: {{ '{{' }} common_web_user }}
- name: write supervisord config - name: write supervisord config
template: > template:
src=edx/app/supervisor/conf.d.available/{{ role_name }}.conf.j2 src: edx/app/supervisor/conf.d.available/{{ role_name }}.conf.j2
dest="{{ '{{' }} supervisor_available_dir }}/{{ '{{' }} {{ role_name }}_service_name }}.conf" dest: "{{ '{{' }} supervisor_available_dir }}/{{ '{{' }} {{ role_name }}_service_name }}.conf"
owner={{ '{{' }} supervisor_user }} group={{ '{{' }} common_web_user }} mode=0644 owner: {{ '{{' }} supervisor_user }}
group: {{ '{{' }} common_web_user }}
mode: 0644
- name: setup the {{ role_name }} env file - name: setup the {{ role_name }} env file
template: > template:
src="./{{ '{{' }} {{ role_name }}_home }}/{{ '{{' }} {{ role_name }}_service_name }}_env.j2" src: "./{{ '{{' }} {{ role_name }}_home }}/{{ '{{' }} {{ role_name }}_service_name }}_env.j2"
dest="{{ '{{' }} {{ role_name }}_home }}/{{ role_name }}_env" dest: "{{ '{{' }} {{ role_name }}_home }}/{{ role_name }}_env"
owner={{ '{{' }} {{ role_name }}_user }} owner: {{ '{{' }} {{ role_name }}_user }}
group={{ '{{' }} {{ role_name }}_user }} group: {{ '{{' }} {{ role_name }}_user }}
mode=0644 mode: 0644
- name: enable supervisor script - name: enable supervisor script
file: > file:
src={{ '{{' }} supervisor_available_dir }}/{{ '{{' }} {{ role_name }}_service_name }}.conf src: {{ '{{' }} supervisor_available_dir }}/{{ '{{' }} {{ role_name }}_service_name }}.conf
dest={{ '{{' }} supervisor_cfg_dir }}/{{ '{{' }} {{ role_name }}_service_name }}.conf dest: {{ '{{' }} supervisor_cfg_dir }}/{{ '{{' }} {{ role_name }}_service_name }}.conf
state=link state: link
force=yes force: yes
when: not disable_edx_services when: not disable_edx_services
- name: update supervisor configuration - name: update supervisor configuration
...@@ -71,28 +75,28 @@ ...@@ -71,28 +75,28 @@
when: not disable_edx_services when: not disable_edx_services
- name: create symlinks from the-er venv bin dir - name: create symlinks from the-er venv bin dir
file: > file:
src="{{ '{{' }} {{ role_name }}_home }}/venvs/{{ '{{' }} {{ role_name }}_service_name }}/bin/{{ '{{' }} item }}" src: "{{ '{{' }} {{ role_name }}_home }}/venvs/{{ '{{' }} {{ role_name }}_service_name }}/bin/{{ '{{' }} item }}"
dest="{{ '{{' }} COMMON_BIN_DIR }}/{{ '{{' }} item.split('.')[0] }}.{{ role_name }}" dest: "{{ '{{' }} COMMON_BIN_DIR }}/{{ '{{' }} item.split('.')[0] }}.{{ role_name }}"
state=link state: link
with_items: with_items:
- python - python
- pip - pip
- django-admin.py - django-admin.py
- name: create symlinks from the repo dir - name: create symlinks from the repo dir
file: > file:
src="{{ '{{' }} {{ role_name }}_code_dir }}/{{ item }}" src: "{{ '{{' }} {{ role_name }}_code_dir }}/{{ item }}"
dest="{{ '{{' }} COMMON_BIN_DIR }}/{{ '{{' }} item.split('.')[0] }}.{{ role_name }}" dest: "{{ '{{' }} COMMON_BIN_DIR }}/{{ '{{' }} item.split('.')[0] }}.{{ role_name }}"
state=link state: link
with_items: with_items:
- manage.py - manage.py
- name: restart the applicaton - name: restart the applicaton
supervisorctl: > supervisorctl:
state=restarted state: restarted
supervisorctl_path={{ '{{' }} supervisor_ctl }} supervisorctl_path: {{ '{{' }} supervisor_ctl }}
config={{ '{{' }} supervisor_cfg }} config: {{ '{{' }} supervisor_cfg }}
name={{ '{{' }} {{ role_name }}_service_name }} name: {{ '{{' }} {{ role_name }}_service_name }}
when: not disable_edx_services when: not disable_edx_services
sudo_user: "{{ '{{' }} supervisor_service_user }}" sudo_user: "{{ '{{' }} supervisor_service_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