Commit 6e7fb883 by Arbab Nazar

Merge pull request #3084 from edx/arbab/forum-rewrite

use the YAML style parameter passing
parents aa8370dc 94ef4e8c
---
- name: restart the forum service
supervisorctl: >
name=forum
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=restarted
supervisorctl:
name: forum
supervisorctl_path: "{{ supervisor_ctl }}"
config: "{{ supervisor_cfg }}"
state: restarted
when: forum_installed is defined and not disable_edx_services
---
- name: create the supervisor config
template: >
src=forum.conf.j2 dest={{ supervisor_available_dir }}/forum.conf
owner={{ supervisor_user }}
group={{ supervisor_user }}
mode=0644
template:
src: forum.conf.j2
dest: "{{ supervisor_available_dir }}/forum.conf"
owner: "{{ supervisor_user }}"
group: "{{ supervisor_user }}"
mode: 0644
sudo_user: "{{ supervisor_user }}"
register: forum_supervisor
tags:
......@@ -13,13 +13,13 @@
- install:configuration
- name: enable the supervisor config
file: >
src={{ supervisor_available_dir }}/forum.conf
dest={{ supervisor_cfg_dir }}/forum.conf
owner={{ supervisor_user }}
state=link
force=yes
mode=0644
file:
src: "{{ supervisor_available_dir }}/forum.conf"
dest: "{{ supervisor_cfg_dir }}/forum.conf"
owner: "{{ supervisor_user }}"
state: link
force: yes
mode: 0644
sudo_user: "{{ supervisor_user }}"
when: not disable_edx_services
register: forum_supervisor
......@@ -28,20 +28,22 @@
- install:configuration
- name: create the supervisor wrapper
template: >
src={{ forum_supervisor_wrapper|basename }}.j2
dest={{ forum_supervisor_wrapper }}
mode=0755
template:
src: "{{ forum_supervisor_wrapper|basename }}.j2"
dest: "{{ forum_supervisor_wrapper }}"
mode: 0755
sudo_user: "{{ forum_user }}"
notify: restart the forum service
tags:
- install
- install:configuration
- name: git checkout forum repo into {{ forum_code_dir }}
git_2_0_1: >
dest={{ forum_code_dir }} repo={{ forum_source_repo }} version={{ forum_version }}
accept_hostkey=yes
- name: git checkout forum repo into {{ forum_code_dir }}
git_2_0_1:
dest: "{{ forum_code_dir }}"
repo: "{{ forum_source_repo }}"
version: "{{ forum_version }}"
accept_hostkey: yes
sudo_user: "{{ forum_user }}"
register: forum_checkout
notify: restart the forum service
......@@ -50,7 +52,7 @@
- install:code
- name: install comments service bundle
shell: bundle install --deployment --path {{ forum_gem_root }} chdir={{ forum_code_dir }}
shell: "bundle install --deployment --path {{ forum_gem_root }} chdir={{ forum_code_dir }}"
sudo_user: "{{ forum_user }}"
environment: "{{ forum_environment }}"
notify: restart the forum service
......@@ -73,18 +75,23 @@
- manage:update
- name: ensure forum is started
supervisorctl: >
name=forum
supervisorctl_path={{ supervisor_ctl }}
config={{ supervisor_cfg }}
state=started
supervisorctl:
name: forum
supervisorctl_path: "{{ supervisor_ctl }}"
config: "{{ supervisor_cfg }}"
state: started
when: not disable_edx_services
tags:
- manage
- include: test.yml tags=deploy
- include: test.yml
tags:
- deploy
- include: tag_ec2.yml tags=deploy
- include: tag_ec2.yml
when: COMMON_TAG_EC2_INSTANCE
tags:
- deploy
- set_fact: forum_installed=true
- set_fact:
forum_installed: true
---
# forum
#
# Dependencies:
......@@ -22,12 +21,12 @@
# - forum
- name: create application user
user: >
name="{{ forum_user }}"
home="{{ forum_app_dir }}"
createhome=yes
shell=/bin/false
generate_ssh_key=yes
user:
name: "{{ forum_user }}"
home: "{{ forum_app_dir }}"
createhome: yes
shell: /bin/false
generate_ssh_key: yes
notify: restart the forum service
tags:
- install
......@@ -35,21 +34,23 @@
# Ensure the directory is accessible to the web service
- name: set forum app dir permissions
file: >
path="{{ forum_app_dir }}"
state=directory
owner="{{ forum_user }}"
group="{{ common_web_group }}"
file:
path: "{{ forum_app_dir }}"
state: directory
owner: "{{ forum_user }}"
group: "{{ common_web_group }}"
notify: restart the forum service
tags:
- install
- install:base
- name: setup the forum env
template: >
src=forum_env.j2 dest={{ forum_app_dir }}/forum_env
owner={{ forum_user }} group={{ common_web_user }}
mode=0644
template:
src: forum_env.j2
dest: "{{ forum_app_dir }}/forum_env"
owner: "{{ forum_user }}"
group: "{{ common_web_user }}"
mode: 0644
notify:
- restart the forum service
tags:
......@@ -57,12 +58,16 @@
- install:base
- name: create {{ forum_data_dir }}
file: >
path={{ forum_data_dir }} state=directory
owner="{{ common_web_user }}" group="{{ common_web_group }}"
mode=0777
file:
path: "{{ forum_data_dir }}"
state: directory
owner: "{{ common_web_user }}"
group: "{{ common_web_group }}"
mode: 0777
tags:
- install
- install:base
- include: deploy.yml tags=deploy
- include: deploy.yml
tags:
- deploy
---
- name: get instance information
action: ec2_facts
- name: tag instance
ec2_tag: resource={{ ansible_ec2_instance_id }} region={{ ansible_ec2_placement_region }}
args:
tags:
ec2_tag:
resource: "{{ ansible_ec2_instance_id }}"
region: "{{ ansible_ec2_placement_region }}"
tags:
"version:forum" : "{{ forum_source_repo }} {{ forum_checkout.after|truncate(7,True,'') }}"
when: forum_checkout.after is defined
---
- name: test that the required service are listening
wait_for: port={{ item.port }} host={{ item.host }} timeout=30
with_items: forum_services
wait_for:
port: "{{ item.port }}"
host: "{{ item.host }}"
timeout: 30
with_items: "{{ forum_services }}"
when: not disable_edx_services
- name: test that mongo replica set members are listing
wait_for: port={{ FORUM_MONGO_PORT }} host={{ item }} timeout=30
with_items: FORUM_MONGO_HOSTS
wait_for:
port: "{{ FORUM_MONGO_PORT }}"
host: "{{ item }}"
timeout: 30
with_items: "{{ FORUM_MONGO_HOSTS }}"
when: not disable_edx_services
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