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