Commit 863e1fee by Feanil Patel

We don't use this bot.

parent 43fa81e7
# Configure an admin instance with jenkins and asgard.
- name: Configure instance(s)
hosts: all
become: True
gather_facts: True
roles:
- aws
- xsy
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://openedx.atlassian.net/wiki/display/OpenOPS
# code style: https://openedx.atlassian.net/wiki/display/OpenOPS/Ansible+Code+Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
##
# Defaults for role xsy
#
#
# vars are namespace with the module name.
#
XSY_USERNAME: '1234_1234@chat.hipchat.com'
XSY_PASSWORD: 'password'
XSY_V1_TOKEN: 'HIPCHAT_V1_TOKEN'
XSY_V2_TOKEN: 'HIPCHAT_V2_TOKEN'
XSY_WILL_ROOMS: 'Hammer'
XSY_NAME: 'xsy'
XSY_HANDLE: 'xsy'
XSY_REDIS_URL: 'redis://fakeuser:redispassword@localhost:6379'
XSY_HTTPSERVER_PORT: '8081'
XSY_WORLD_WEATHER_KEY: !!null
xsy_service_name: xsy
xsy_user: xsy
xsy_app_dir: "{{ COMMON_APP_DIR }}/xsy"
xsy_code_dir: "{{ xsy_app_dir }}/xsy"
xsy_venvs_dir: "{{ xsy_app_dir }}/venvs"
xsy_venv_dir: "{{ xsy_venvs_dir }}/xsy"
xsy_venv_bin: "{{ xsy_venv_dir }}/bin"
xsy_source_repo: "https://github.com/edx/xsy.git"
xsy_version: "HEAD"
xsy_requirements_file: "{{ xsy_code_dir }}/requirements.txt"
xsy_supervisor_wrapper: "{{ xsy_app_dir }}/xsy-supervisor.sh"
xsy_environment:
WILL_USERNAME: "{{ XSY_USERNAME }}"
WILL_PASSWORD: "{{ XSY_PASSWORD }}"
WILL_V1_TOKEN: "{{ XSY_V1_TOKEN }}"
WILL_V2_TOKEN: "{{ XSY_V2_TOKEN }}"
WILL_NAME: "{{ XSY_NAME }}"
WILL_HANDLE: "{{ XSY_HANDLE }}"
WILL_REDIS_URL: "{{ XSY_REDIS_URL }}"
WILL_HTTPSERVER_PORT: "{{ XSY_HTTPSERVER_PORT }}"
WILL_WORLD_WEATHER_ONLINE_KEY: "{{ XSY_WORLD_WEATHER_KEY }}"
WILL_ROOMS: "{{ XSY_WILL_ROOMS }}"
#
# OS packages
#
xsy_debian_pkgs: []
xsy_redhat_pkgs: []
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://openedx.atlassian.net/wiki/display/OpenOPS
# code style: https://openedx.atlassian.net/wiki/display/OpenOPS/Ansible+Code+Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
#
#
# Handlers for role xsy
#
# Overview:
#
#
- name: restart xsy
supervisorctl:
name: xsy
supervisorctl_path: "{{ supervisor_ctl }}"
config: "{{ supervisor_cfg }}"
state: restarted
when: not disable_edx_services
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://openedx.atlassian.net/wiki/display/OpenOPS
# code style: https://openedx.atlassian.net/wiki/display/OpenOPS/Ansible+Code+Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
##
# Role includes for role xsy
#
# Example:
#
# dependencies:
# - {
# role: my_role
# my_role_var0: "foo"
# my_role_var1: "bar"
# }
dependencies:
- common
- supervisor
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://openedx.atlassian.net/wiki/display/OpenOPS
# code style: https://openedx.atlassian.net/wiki/display/OpenOPS/Ansible+Code+Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
#
#
# Tasks for role xsy
#
# Overview:
#
#
# Dependencies:
#
#
# Example play:
#
#
- name: Create application user
user:
name: "{{ xsy_user }}"
home: "{{ xsy_app_dir }}"
createhome: no
shell: /bin/false
- name: Create xsy user dirs
file:
path: "{{ item }}"
state: directory
owner: "{{ xsy_user }}"
group: "{{ common_web_group }}"
with_items:
- "{{ xsy_app_dir }}"
- "{{ xsy_venvs_dir }}"
- name: Setup the xsy env
template:
src: "xsy_env.j2"
dest: "{{ xsy_app_dir }}/xsy_env"
owner: "{{ xsy_user }}"
group: "{{ common_web_user }}"
mode: "0644"
notify: restart xsy
- name: Checkout the code
git:
dest: "{{ xsy_code_dir }}"
repo: "{{ xsy_source_repo }}"
version: "{{ xsy_version }}"
accept_hostkey: yes
become_user: "{{ xsy_user }}"
register: xsy_checkout
notify: restart xsy
- name: Install the requirements
pip:
requirements: "{{ xsy_requirements_file }}"
virtualenv: "{{ xsy_venv_dir }}"
state: present
extra_args: "-i {{ COMMON_PYPI_MIRROR_URL }}"
become_user: "{{ xsy_user }}"
notify: restart xsy
- name: Create the supervisor wrapper
template:
src: "{{ xsy_supervisor_wrapper | basename }}.j2"
dest: "{{ xsy_supervisor_wrapper }}"
mode: "0755"
become_user: "{{ xsy_user }}"
notify: restart xsy
- name: Create a supervisor config
template:
src: "xsy.conf.j2"
dest: "{{ supervisor_available_dir }}/xsy.conf"
owner: "{{ supervisor_user }}"
group: "{{ supervisor_user }}"
become_user: "{{ supervisor_user }}"
notify: restart xsy
- name: Enable the supervisor config
file:
src: "{{ supervisor_available_dir }}/xsy.conf"
dest: "{{ supervisor_cfg_dir }}/xsy.conf"
state: link
force: yes
mode: "0644"
become_user: "{{ supervisor_user }}"
when: not disable_edx_services
notify: restart xsy
- name: Update supervisor configuration
shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update"
register: supervisor_update
changed_when: supervisor_update.stdout is defined and supervisor_update.stdout != ""
when: not disable_edx_services
- name: Ensure xsy is started
supervisorctl:
name: xsy
supervisorctl_path: "{{ supervisor_ctl }}"
config: "{{ supervisor_cfg }}"
state: started
when: not disable_edx_services
- include: tag_ec2.yml
when: COMMON_TAG_EC2_INSTANCE
tags:
- deploy
---
- name: get instance information
action: ec2_facts
tags:
- deploy
- name: Tag instance
ec2_tag:
resource: "{{ ansible_ec2_instance_id }}"
region: "{{ ansible_ec2_placement_region }}"
tags:
"version:xsy" : "{{ xsy_source_repo }} {{ xsy_checkout.after }}"
when: xsy_checkout.after is defined
tags:
- deploy
#!/bin/bash
source {{ xsy_app_dir }}/xsy_env
cd {{ xsy_code_dir }}
{{ xsy_venv_bin }}/python run_will.py
[program:xsy]
command={{ xsy_supervisor_wrapper }}
priority=999
user={{ common_web_user }}
stdout_logfile={{ supervisor_log_dir }}/%(program_name)s-stdout.log
stderr_logfile={{ supervisor_log_dir }}/%(program_name)s-stderr.log
killasgroup=true
stopasgroup=true
stopsignal=QUIT
# {{ ansible_managed }}
{% for name,value in xsy_environment.items() -%}
{%- if value -%}
export {{ name }}='{{ value }}'
{% endif %}
{%- endfor %}
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