Commit 39bafa48 by Edward Zarecor

Merge pull request #2352 from edx/e0d/diverse-virtualization-targets

E0d/diverse virtualization targets
parents 279423d1 1163e80c
FROM edxops/precise-common:v2 FROM edxops/precise-common
MAINTAINER edxops MAINTAINER edxops
USER docker USER docker
WORKDIR /edx/app/edx_ansible/edx_ansible WORKDIR /edx/app/edx_ansible/edx_ansible
RUN sudo git fetch --all RUN sudo git fetch --all
RUN sudo git checkout e0d/docker-latest RUN sudo git checkout e0d/diverse-virtualization-targets
RUN sudo git reset --hard origin/e0d/docker-latest RUN sudo git reset --hard e0d/diverse-virtualization-targets
RUN sudo git pull RUN sudo git pull
WORKDIR /edx/app/edx_ansible/edx_ansible/docker/plays WORKDIR /edx/app/edx_ansible/edx_ansible/docker/plays
RUN sudo ansible-playbook edxapp.yml -c local -e "EDXAPP_PYTHON_SANDBOX=false" ADD ansible.cfg /edx/app/edx_ansible/edx_ansible/docker/plays/ansible.cfg
RUN sudo ansible-playbook edxapp.yml -c local -e "EDXAPP_PYTHON_SANDBOX=false" -t 'install:base'
RUN sudo ansible-playbook edxapp.yml -c local -e "EDXAPP_PYTHON_SANDBOX=false" -t 'install:code'
RUN sudo ansible-playbook edxapp.yml -c local -e "EDXAPP_PYTHON_SANDBOX=false" -t 'install:configuration'
USER root USER root
CMD ["/edx/app/supervisor/venvs/supervisor/bin/supervisord", "-n", "--configuration", "/edx/app/supervisor/supervisord.conf"] CMD ["/edx/app/supervisor/venvs/supervisor/bin/supervisord", "-n", "--configuration", "/edx/app/supervisor/supervisord.conf"]
EXPOSE 18000 48000 18020 18010 48010 8010 8000 EXPOSE 18000 48000 18020 18010 48010 8010 8000
[defaults]
jinja2_extensions=jinja2.ext.do
...@@ -2,8 +2,17 @@ FROM edxops/precise-common:v2 ...@@ -2,8 +2,17 @@ FROM edxops/precise-common:v2
MAINTAINER edxops MAINTAINER edxops
USER docker USER docker
RUN sudo apt-get update
WORKDIR /edx/app/edx_ansible/edx_ansible
RUN sudo git fetch --all
RUN sudo git checkout e0d/diverse-virtualization-targets
RUN sudo git reset --hard e0d/diverse-virtualization-targets
RUN sudo git pull
WORKDIR /edx/app/edx_ansible/edx_ansible/docker/plays WORKDIR /edx/app/edx_ansible/edx_ansible/docker/plays
RUN sudo ansible-playbook forum.yml -c local
RUN sudo ansible-playbook forum.yml -c local -t 'install:base,install:configuration,install:code' -e '{"FORUM_MONGO_HOSTS":["forums-mongo.local.edx.org"]}' -e FORUM_ELASTICSEARCH_HOST='forums-elasticsearch.local.edx.org'
USER root USER root
CMD ["/edx/app/supervisor/venvs/supervisor/bin/supervisord", "-n", "--configuration", "/edx/app/supervisor/supervisord.conf"] CMD ["/edx/app/supervisor/venvs/supervisor/bin/supervisord", "-n", "--configuration", "/edx/app/supervisor/supervisord.conf"]
#ENTRYPOINT ["/bin/bash"] #ENTRYPOINT ["/bin/bash"]
......
FROM ubuntu:precise FROM ubuntu:precise
MAINTAINER e0d MAINTAINER edxops
RUN apt-get update RUN apt-get update
RUN apt-get -y install sudo RUN apt-get -y install sudo
...@@ -9,7 +9,6 @@ RUN mkdir -p /home/docker && chown -R docker:docker /home/docker ...@@ -9,7 +9,6 @@ RUN mkdir -p /home/docker && chown -R docker:docker /home/docker
RUN apt-get install -y python2.7 python2.7-dev python-pip python-apt python-yaml python-jinja2 git RUN apt-get install -y python2.7 python2.7-dev python-pip python-apt python-yaml python-jinja2 git
USER docker USER docker
RUN echo "cachebust"
# bootstrap # bootstrap
RUN sudo git clone --recursive https://github.com/edx/ansible /tmp/ansible RUN sudo git clone --recursive https://github.com/edx/ansible /tmp/ansible
WORKDIR /tmp/ansible WORKDIR /tmp/ansible
...@@ -20,11 +19,11 @@ ENV PATH /tmp/ansible/bin:/bin:/sbin:/usr/sbin:/usr/bin ...@@ -20,11 +19,11 @@ ENV PATH /tmp/ansible/bin:/bin:/sbin:/usr/sbin:/usr/bin
RUN sudo git clone http://github.com/edx/configuration.git /tmp/configuration RUN sudo git clone http://github.com/edx/configuration.git /tmp/configuration
ADD inventory /etc/ansible/hosts ADD inventory /etc/ansible/hosts
WORKDIR /tmp/configuration WORKDIR /tmp/configuration
RUN sudo git checkout e0d/sever-aws-deps RUN sudo git checkout e0d/diverse-virtualization-targets
RUN sudo pip install -r pre-requirements.txt RUN sudo pip install -r pre-requirements.txt
RUN sudo pip install -r requirements.txt RUN sudo pip install -r requirements.txt
WORKDIR /tmp/configuration/playbooks/edx-east WORKDIR /tmp/configuration/playbooks/edx-east
RUN sudo /tmp/ansible/bin/ansible-playbook edx_ansible.yml -c local -e "configuration_version=e0d/sever-aws-deps" RUN sudo /tmp/ansible/bin/ansible-playbook edx_ansible.yml -c local -e "configuration_version=e0d/diverse-virtualization-targets"
# cleanup # cleanup
RUN sudo rm -rf /tmp/ansible RUN sudo rm -rf /tmp/ansible
......
---
db: db:
image: mysql:5.6 image: mysql:5.6
environment: environment:
......
...@@ -8,15 +8,3 @@ ...@@ -8,15 +8,3 @@
roles: roles:
- docker - docker
- edxapp - edxapp
- role: datadog
when: COMMON_ENABLE_DATADOG
- role: splunkforwarder
when: COMMON_ENABLE_SPLUNKFORWARDER
- role: newrelic
NEWRELIC_LOGWATCH:
- logwatch-503.j2
- logwatch-cms-errors.j2
- logwatch-lms-errors.j2
when: COMMON_ENABLE_NEWRELIC
- role: minos
when: COMMON_ENABLE_MINOS
...@@ -108,14 +108,3 @@ ...@@ -108,14 +108,3 @@
template: src=etc/dhcp/dhclient.conf.j2 dest=/etc/dhcp/dhclient.conf template: src=etc/dhcp/dhclient.conf.j2 dest=/etc/dhcp/dhclient.conf
when: COMMON_CUSTOM_DHCLIENT_CONFIG when: COMMON_CUSTOM_DHCLIENT_CONFIG
- name: add ssh-warning banner motd
template: >
dest=/etc/motd.tail
src={{ COMMON_MOTD_TEMPLATE }} mode=0755 owner=root group=root
- name: update ssh config
template: >
dest=/etc/ssh/sshd_config
src=sshd_config.j2 mode=0644 owner=root group=root
notify: restart ssh
\ No newline at end of file
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://github.com/edx/configuration/wiki
# code style: https://github.com/edx/configuration/wiki/Ansible-Coding-Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
##
# Defaults for role container
#
#
# vars are namespace with the module name.
#
container_role_name: container
#
# OS packages
#
container_debian_pkgs: []
container_redhat_pkgs: []
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://github.com/edx/configuration/wiki
# code style: https://github.com/edx/configuration/wiki/Ansible-Coding-Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
##
# Role includes for role container
#
# Example:
#
# dependencies:
# - {
# role: my_role
# my_role_var0: "foo"
# my_role_var1: "bar"
# }
dependencies:
- common
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://github.com/edx/configuration/wiki
# code style: https://github.com/edx/configuration/wiki/Ansible-Coding-Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
#
#
# Tasks for role container
#
# Overview:
#
#
# Dependencies:
#
#
# Example play:
#
#
- name: stub ansible task
debug: msg="This is a stub task created by the ansible-role role"
notify: notify me
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://github.com/edx/configuration/wiki
# code style: https://github.com/edx/configuration/wiki/Ansible-Coding-Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
##
# Defaults for role docker
#
#
# vars are namespace with the module name.
#
docker_role_name: docker
#
# OS packages
#
docker_debian_pkgs: []
docker_redhat_pkgs: []
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://github.com/edx/configuration/wiki
# code style: https://github.com/edx/configuration/wiki/Ansible-Coding-Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
##
# Role includes for role docker
#
# Example:
#
# dependencies:
# - {
# role: my_role
# my_role_var0: "foo"
# my_role_var1: "bar"
# }
dependencies:
- container
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://github.com/edx/configuration/wiki
# code style: https://github.com/edx/configuration/wiki/Ansible-Coding-Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
#
#
# Tasks for role docker
#
# Overview:
#
#
# Dependencies:
#
#
# Example play:
#
#
- name: stub ansible task
debug: msg="This is a stub task created by the ansible-role role"
notify: notify me
...@@ -1021,6 +1021,7 @@ edxapp_debian_pkgs: ...@@ -1021,6 +1021,7 @@ edxapp_debian_pkgs:
- ntp - ntp
# matplotlib needs libfreetype6-dev # matplotlib needs libfreetype6-dev
- libfreetype6-dev - libfreetype6-dev
- libmysqlclient-dev
# Ruby Specific Vars # Ruby Specific Vars
edxapp_ruby_version: "1.9.3-p374" edxapp_ruby_version: "1.9.3-p374"
......
...@@ -6,8 +6,6 @@ dependencies: ...@@ -6,8 +6,6 @@ dependencies:
rbenv_user: "{{ edxapp_user }}" rbenv_user: "{{ edxapp_user }}"
rbenv_dir: "{{ edxapp_app_dir }}" rbenv_dir: "{{ edxapp_app_dir }}"
rbenv_ruby_version: "{{ edxapp_ruby_version }}" rbenv_ruby_version: "{{ edxapp_ruby_version }}"
- devpi
- nltk
- role: user - role: user
user_info: user_info:
- name: "{{ EDXAPP_AUTOMATOR_NAME }}" - name: "{{ EDXAPP_AUTOMATOR_NAME }}"
......
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
user: > user: >
name="{{ edxapp_user }}" home="{{ edxapp_app_dir }}" name="{{ edxapp_user }}" home="{{ edxapp_app_dir }}"
createhome=no shell=/bin/false createhome=no shell=/bin/false
tags:
- install
- install:base
- name: create edxapp user dirs - name: create edxapp user dirs
file: > file: >
...@@ -20,13 +23,19 @@ ...@@ -20,13 +23,19 @@
- "{{ edxapp_staticfile_dir }}" - "{{ edxapp_staticfile_dir }}"
- "{{ edxapp_course_static_dir }}" - "{{ edxapp_course_static_dir }}"
- "{{ edxapp_course_data_dir }}" - "{{ edxapp_course_data_dir }}"
tags:
- install
- install:base
# var should have more permissive permissions than the rest # var should have more permissive permissions than the rest
- name: create edxapp var dir - name: create edxapp var dir
file: > file: >
path={{ edxapp_data_dir }} state=directory mode=0775 path={{ edxapp_data_dir }} state=directory mode=0775
owner="{{ edxapp_user }}" group="{{ common_web_group }}" owner="{{ edxapp_user }}" group="{{ common_web_group }}"
tags:
- install
- install:base
# This is a symlink that has to exist because # This is a symlink that has to exist because
# we currently can't override the DATA_DIR var # we currently can't override the DATA_DIR var
# in edx-platform. TODO: This can be removed once # in edx-platform. TODO: This can be removed once
...@@ -38,12 +47,18 @@ ...@@ -38,12 +47,18 @@
state=link state=link
owner="{{ edxapp_user }}" owner="{{ edxapp_user }}"
group="{{ common_web_group }}" group="{{ common_web_group }}"
tags:
- install
- install:base
- name: create edxapp log dir - name: create edxapp log dir
file: > file: >
path="{{ edxapp_log_dir }}" state=directory path="{{ edxapp_log_dir }}" state=directory
owner="{{ common_log_user }}" group="{{ common_log_user }}" owner="{{ common_log_user }}" group="{{ common_log_user }}"
tags:
- install
- install:base
- name: create web-writable edxapp data dirs - name: create web-writable edxapp data dirs
file: > file: >
path="{{ item }}" state=directory path="{{ item }}" state=directory
...@@ -53,27 +68,42 @@ ...@@ -53,27 +68,42 @@
- "{{ edxapp_course_data_dir }}" - "{{ edxapp_course_data_dir }}"
- "{{ edxapp_upload_dir }}" - "{{ edxapp_upload_dir }}"
- "{{ edxapp_media_dir }}" - "{{ edxapp_media_dir }}"
tags:
- install
- install:base
# adding chris-lea nodejs repo # adding chris-lea nodejs repo
- name: add ppas for current versions of nodejs - name: add ppas for current versions of nodejs
apt_repository: repo="{{ edxapp_chrislea_ppa }}" apt_repository: repo="{{ edxapp_chrislea_ppa }}"
tags:
- install
- install:base
- name: install system packages on which LMS and CMS rely - name: install system packages on which LMS and CMS rely
apt: pkg={{','.join(edxapp_debian_pkgs)}} state=present update_cache=yes apt: pkg={{','.join(edxapp_debian_pkgs)}} state=present update_cache=yes
tags:
- install
- install:base
- name: set up edxapp .npmrc - name: set up edxapp .npmrc
template: template:
src=.npmrc.j2 dest={{ edxapp_app_dir }}/.npmrc src=.npmrc.j2 dest={{ edxapp_app_dir }}/.npmrc
owner={{ edxapp_user }} group={{ common_web_group }} owner={{ edxapp_user }} group={{ common_web_group }}
mode=0600 mode=0600
tags:
- install
- install:base
- name: create log directories for service variants - name: create log directories for service variants
file: > file: >
path={{ edxapp_log_dir }}/{{ item }} state=directory path={{ edxapp_log_dir }}/{{ item }} state=directory
owner={{ common_log_user }} group={{ common_log_user }} owner={{ common_log_user }} group={{ common_log_user }}
mode=0750 mode=0750
with_items: service_variants_enabled with_items: service_variants_enabled
tags:
- install
- install:base
# Set up the python sandbox execution environment # Set up the python sandbox execution environment
- include: python_sandbox_env.yml tags=deploy - include: python_sandbox_env.yml tags=deploy
when: EDXAPP_PYTHON_SANDBOX when: EDXAPP_PYTHON_SANDBOX
......
...@@ -3,33 +3,44 @@ ...@@ -3,33 +3,44 @@
src={{ item }}.env.json.j2 src={{ item }}.env.json.j2
dest={{ edxapp_app_dir }}/{{ item }}.env.json dest={{ edxapp_app_dir }}/{{ item }}.env.json
sudo_user: "{{ edxapp_user }}" sudo_user: "{{ edxapp_user }}"
tags: edxapp_cfg
with_items: service_variants_enabled with_items: service_variants_enabled
tags:
- install
- install:configration
- edxapp_cfg
- name: "create {{ item }} auth file" - name: "create {{ item }} auth file"
template: > template: >
src={{ item }}.auth.json.j2 src={{ item }}.auth.json.j2
dest={{ edxapp_app_dir }}/{{ item }}.auth.json dest={{ edxapp_app_dir }}/{{ item }}.auth.json
sudo_user: "{{ edxapp_user }}" sudo_user: "{{ edxapp_user }}"
tags: edxapp_cfg
with_items: service_variants_enabled with_items: service_variants_enabled
tags:
- install
- install:configuration
- edxapp_cfg
- name: "create {{ item }} yaml application config" - name: "create {{ item }} yaml application config"
template: > template: >
src={{ item }}.env.yaml.j2 src={{ item }}.env.yaml.j2
dest={{ EDXAPP_CFG_DIR }}/{{ item }}.env.yaml dest={{ EDXAPP_CFG_DIR }}/{{ item }}.env.yaml
sudo_user: "{{ edxapp_user }}" sudo_user: "{{ edxapp_user }}"
tags: edxapp_cfg
with_items: service_variants_enabled with_items: service_variants_enabled
tags:
- install
- install:configuration
- edxapp_cfg
- name: "create {{ item }} yaml auth file" - name: "create {{ item }} yaml auth file"
template: > template: >
src={{ item }}.auth.yaml.j2 src={{ item }}.auth.yaml.j2
dest={{ EDXAPP_CFG_DIR }}/{{ item }}.auth.yaml dest={{ EDXAPP_CFG_DIR }}/{{ item }}.auth.yaml
sudo_user: "{{ edxapp_user }}" sudo_user: "{{ edxapp_user }}"
tags: edxapp_cfg
with_items: service_variants_enabled with_items: service_variants_enabled
tags:
- install
- install:configuration
- edxapp_cfg
# write the supervisor scripts for the service variants # write the supervisor scripts for the service variants
...@@ -40,6 +51,9 @@ ...@@ -40,6 +51,9 @@
group={{ supervisor_user }} group={{ supervisor_user }}
with_items: service_variants_enabled with_items: service_variants_enabled
sudo_user: "{{ supervisor_user }}" sudo_user: "{{ supervisor_user }}"
tags:
- install
- install:configuration
- name: writing edxapp supervisor script - name: writing edxapp supervisor script
template: > template: >
...@@ -47,12 +61,18 @@ ...@@ -47,12 +61,18 @@
owner={{ supervisor_user }} owner={{ supervisor_user }}
group={{ supervisor_user }} group={{ supervisor_user }}
sudo_user: "{{ supervisor_user }}" sudo_user: "{{ supervisor_user }}"
tags:
- install
- install:configuration
- name: "add gunicorn configuration files" - name: "add gunicorn configuration files"
template: > template: >
src={{ item }}_gunicorn.py.j2 dest={{ edxapp_app_dir }}/{{ item }}_gunicorn.py src={{ item }}_gunicorn.py.j2 dest={{ edxapp_app_dir }}/{{ item }}_gunicorn.py
with_items: service_variants_enabled with_items: service_variants_enabled
sudo_user: "{{ edxapp_user }}" sudo_user: "{{ edxapp_user }}"
tags:
- install
- install:configuration
# write the supervisor script for celery workers # write the supervisor script for celery workers
...@@ -62,6 +82,9 @@ ...@@ -62,6 +82,9 @@
owner={{ supervisor_user }} owner={{ supervisor_user }}
group={{ supervisor_user }} group={{ supervisor_user }}
sudo_user: "{{ supervisor_user }}" sudo_user: "{{ supervisor_user }}"
tags:
- install
- install:configuration
# Enable the supervisor jobs # Enable the supervisor jobs
- name: "enable {{ item }} supervisor script" - name: "enable {{ item }} supervisor script"
...@@ -73,6 +96,9 @@ ...@@ -73,6 +96,9 @@
with_items: service_variants_enabled with_items: service_variants_enabled
when: celery_worker is not defined and not disable_edx_services when: celery_worker is not defined and not disable_edx_services
sudo_user: "{{ supervisor_user }}" sudo_user: "{{ supervisor_user }}"
tags:
- install
- install:configuration
- name: "enable edxapp supervisor script" - name: "enable edxapp supervisor script"
file: > file: >
...@@ -82,6 +108,9 @@ ...@@ -82,6 +108,9 @@
force=yes force=yes
when: celery_worker is not defined and not disable_edx_services when: celery_worker is not defined and not disable_edx_services
sudo_user: "{{ supervisor_user }}" sudo_user: "{{ supervisor_user }}"
tags:
- install
- install:configuration
- name: "enable celery worker supervisor script" - name: "enable celery worker supervisor script"
file: > file: >
...@@ -91,6 +120,9 @@ ...@@ -91,6 +120,9 @@
force=yes force=yes
when: celery_worker is defined and not disable_edx_services when: celery_worker is defined and not disable_edx_services
sudo_user: "{{ supervisor_user }}" sudo_user: "{{ supervisor_user }}"
tags:
- install
- install:configuration
- name: create helper scripts for managing edxapp - name: create helper scripts for managing edxapp
template: > template: >
...@@ -101,6 +133,9 @@ ...@@ -101,6 +133,9 @@
with_nested: with_nested:
- edxapp_helper_scripts - edxapp_helper_scripts
- service_variants_enabled - service_variants_enabled
tags:
- install
- install:configuration
# Syncdb with migrate when the migrate user is overridden in extra vars # Syncdb with migrate when the migrate user is overridden in extra vars
- name: syncdb and migrate - name: syncdb and migrate
...@@ -111,6 +146,8 @@ ...@@ -111,6 +146,8 @@
DB_MIGRATION_PASS: "{{ COMMON_MYSQL_MIGRATE_PASS }}" DB_MIGRATION_PASS: "{{ COMMON_MYSQL_MIGRATE_PASS }}"
EDX_PLATFORM_SETTINGS_OVERRIDE: "aws_migrate" EDX_PLATFORM_SETTINGS_OVERRIDE: "aws_migrate"
with_items: service_variants_enabled with_items: service_variants_enabled
tags:
- migrate
# Gather assets using paver if possible # Gather assets using paver if possible
...@@ -119,3 +156,5 @@ ...@@ -119,3 +156,5 @@
when: celery_worker is not defined and not devstack and item != "lms-preview" when: celery_worker is not defined and not devstack and item != "lms-preview"
tags: gather_static_assets tags: gather_static_assets
with_items: service_variants_enabled with_items: service_variants_enabled
tags:
- assets
...@@ -3,3 +3,6 @@ ...@@ -3,3 +3,6 @@
- name: Install system packages - name: Install system packages
apt: pkg={{','.join(edxapp_common_debian_pkgs)}} apt: pkg={{','.join(edxapp_common_debian_pkgs)}}
state=present update_cache=yes state=present update_cache=yes
tags:
- install
- install:base
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
register: forum_supervisor register: forum_supervisor
tags: tags:
- install - install
- install:confugration - install:configuration
- name: create the supervisor wrapper - name: create the supervisor wrapper
template: > template: >
...@@ -72,8 +72,8 @@ ...@@ -72,8 +72,8 @@
changed_when: supervisor_update.stdout is defined and supervisor_update.stdout != "" changed_when: supervisor_update.stdout is defined and supervisor_update.stdout != ""
when: not disable_edx_services when: not disable_edx_services
tags: tags:
- install - manage
- install:configuration - manage:update
- name: ensure forum is started - name: ensure forum is started
supervisorctl: > supervisorctl: >
......
1;2802;0c--- ---
# forum # forum
# #
......
...@@ -39,15 +39,24 @@ ...@@ -39,15 +39,24 @@
name={{ rbenv_user }} home={{ rbenv_dir }} name={{ rbenv_user }} home={{ rbenv_dir }}
shell=/bin/false createhome=no shell=/bin/false createhome=no
when: rbenv_user != common_web_user when: rbenv_user != common_web_user
tags:
- install
- install:base
- name: create rbenv dir if it does not exist - name: create rbenv dir if it does not exist
file: > file: >
path="{{ rbenv_dir }}" owner="{{ rbenv_user }}" path="{{ rbenv_dir }}" owner="{{ rbenv_user }}"
state=directory state=directory
tags:
- install
- install:base
- name: install build depends - name: install build depends
apt: pkg={{ ",".join(rbenv_debian_pkgs) }} state=present install_recommends=no apt: pkg={{ ",".join(rbenv_debian_pkgs) }} state=present install_recommends=no
with_items: rbenv_debian_pkgs with_items: rbenv_debian_pkgs
tags:
- install
- install:base
- name: update rbenv repo - name: update rbenv repo
git: > git: >
...@@ -55,22 +64,34 @@ ...@@ -55,22 +64,34 @@
dest={{ rbenv_dir }}/.rbenv version={{ rbenv_version }} dest={{ rbenv_dir }}/.rbenv version={{ rbenv_version }}
accept_hostkey=yes accept_hostkey=yes
sudo_user: "{{ rbenv_user }}" sudo_user: "{{ rbenv_user }}"
tags:
- install
- install:base
- name: ensure ruby_env exists - name: ensure ruby_env exists
template: > template: >
src=ruby_env.j2 dest={{ rbenv_dir }}/ruby_env src=ruby_env.j2 dest={{ rbenv_dir }}/ruby_env
sudo_user: "{{ rbenv_user }}" sudo_user: "{{ rbenv_user }}"
tags:
- install
- install:base
- name: check ruby-build installed - name: check ruby-build installed
command: test -x /usr/local/bin/ruby-build command: test -x /usr/local/bin/ruby-build
register: rbuild_present register: rbuild_present
ignore_errors: yes ignore_errors: yes
tags:
- install
- install:base
- name: if ruby-build exists, which versions we can install - name: if ruby-build exists, which versions we can install
command: /usr/local/bin/ruby-build --definitions command: /usr/local/bin/ruby-build --definitions
when: rbuild_present|success when: rbuild_present|success
register: installable_ruby_vers register: installable_ruby_vers
ignore_errors: yes ignore_errors: yes
tags:
- install
- install:base
### in this block, we (re)install ruby-build if it doesn't exist or if it can't install the requested version ### in this block, we (re)install ruby-build if it doesn't exist or if it can't install the requested version
- name: create temporary directory - name: create temporary directory
...@@ -78,6 +99,9 @@ ...@@ -78,6 +99,9 @@
register: tempdir register: tempdir
sudo_user: "{{ rbenv_user }}" sudo_user: "{{ rbenv_user }}"
when: rbuild_present|failed or (installable_ruby_vers is defined and rbenv_ruby_version not in installable_ruby_vers) when: rbuild_present|failed or (installable_ruby_vers is defined and rbenv_ruby_version not in installable_ruby_vers)
tags:
- install
- install:base
- name: clone ruby-build repo - name: clone ruby-build repo
git: > git: >
...@@ -85,14 +109,23 @@ ...@@ -85,14 +109,23 @@
accept_hostkey=yes accept_hostkey=yes
when: tempdir.stdout is defined and (rbuild_present|failed or (installable_ruby_vers is defined and rbenv_ruby_version not in installable_ruby_vers)) when: tempdir.stdout is defined and (rbuild_present|failed or (installable_ruby_vers is defined and rbenv_ruby_version not in installable_ruby_vers))
sudo_user: "{{ rbenv_user }}" sudo_user: "{{ rbenv_user }}"
tags:
- install
- install:base
- name: install ruby-build - name: install ruby-build
command: ./install.sh chdir={{ tempdir.stdout }}/ruby-build command: ./install.sh chdir={{ tempdir.stdout }}/ruby-build
when: tempdir.stdout is defined and (rbuild_present|failed or (installable_ruby_vers is defined and rbenv_ruby_version not in installable_ruby_vers)) when: tempdir.stdout is defined and (rbuild_present|failed or (installable_ruby_vers is defined and rbenv_ruby_version not in installable_ruby_vers))
tags:
- install
- install:base
- name: remove temporary directory - name: remove temporary directory
file: path={{ tempdir.stdout }} state=absent file: path={{ tempdir.stdout }} state=absent
when: tempdir.stdout is defined and (rbuild_present|failed or (installable_ruby_vers is defined and rbenv_ruby_version not in installable_ruby_vers)) when: tempdir.stdout is defined and (rbuild_present|failed or (installable_ruby_vers is defined and rbenv_ruby_version not in installable_ruby_vers))
tags:
- install
- install:base
- name: check ruby {{ rbenv_ruby_version }} installed - name: check ruby {{ rbenv_ruby_version }} installed
shell: "rbenv versions | grep {{ rbenv_ruby_version }}" shell: "rbenv versions | grep {{ rbenv_ruby_version }}"
...@@ -100,34 +133,55 @@ ...@@ -100,34 +133,55 @@
sudo_user: "{{ rbenv_user }}" sudo_user: "{{ rbenv_user }}"
environment: "{{ rbenv_environment }}" environment: "{{ rbenv_environment }}"
ignore_errors: yes ignore_errors: yes
tags:
- install
- install:base
- name: install ruby {{ rbenv_ruby_version }} - name: install ruby {{ rbenv_ruby_version }}
shell: "rbenv install {{ rbenv_ruby_version }} creates={{ rbenv_dir }}/.rbenv/versions/{{ rbenv_ruby_version }}" shell: "rbenv install {{ rbenv_ruby_version }} creates={{ rbenv_dir }}/.rbenv/versions/{{ rbenv_ruby_version }}"
when: ruby_installed|failed when: ruby_installed|failed
sudo_user: "{{ rbenv_user }}" sudo_user: "{{ rbenv_user }}"
environment: "{{ rbenv_environment }}" environment: "{{ rbenv_environment }}"
tags:
- install
- install:base
- name: set global ruby {{ rbenv_ruby_version }} - name: set global ruby {{ rbenv_ruby_version }}
shell: "rbenv global {{ rbenv_ruby_version }}" shell: "rbenv global {{ rbenv_ruby_version }}"
sudo_user: "{{ rbenv_user }}" sudo_user: "{{ rbenv_user }}"
environment: "{{ rbenv_environment }}" environment: "{{ rbenv_environment }}"
tags:
- install
- install:base
- name: install bundler - name: install bundler
shell: "gem install bundler -v {{ rbenv_bundler_version }}" shell: "gem install bundler -v {{ rbenv_bundler_version }}"
sudo_user: "{{ rbenv_user }}" sudo_user: "{{ rbenv_user }}"
environment: "{{ rbenv_environment }}" environment: "{{ rbenv_environment }}"
tags:
- install
- install:base
- name: remove rbenv version of rake - name: remove rbenv version of rake
file: path="{{ rbenv_dir }}/.rbenv/versions/{{ rbenv_ruby_version }}/bin/rake" state=absent file: path="{{ rbenv_dir }}/.rbenv/versions/{{ rbenv_ruby_version }}/bin/rake" state=absent
when: jenkins_worker is not defined or not jenkins_worker when: jenkins_worker is not defined or not jenkins_worker
tags:
- install
- install:base
- name: install rake gem - name: install rake gem
shell: "gem install rake -v {{ rbenv_rake_version }}" shell: "gem install rake -v {{ rbenv_rake_version }}"
sudo_user: "{{ rbenv_user }}" sudo_user: "{{ rbenv_user }}"
environment: "{{ rbenv_environment }}" environment: "{{ rbenv_environment }}"
when: jenkins_worker is not defined or not jenkins_worker when: jenkins_worker is not defined or not jenkins_worker
tags:
- install
- install:base
- name: rehash - name: rehash
shell: "rbenv rehash" shell: "rbenv rehash"
sudo_user: "{{ rbenv_user }}" sudo_user: "{{ rbenv_user }}"
environment: "{{ rbenv_environment }}" environment: "{{ rbenv_environment }}"
tags:
- install
- install:base
\ No newline at end of file
--- ---
dependencies: dependencies:
- common
...@@ -55,13 +55,19 @@ ...@@ -55,13 +55,19 @@
name="{{ supervisor_user }}" name="{{ supervisor_user }}"
createhome=no createhome=no
shell=/bin/false shell=/bin/false
tags:
- install
- install:base
- name: create supervisor service user - name: create supervisor service user
user: > user: >
name="{{ supervisor_service_user }}" name="{{ supervisor_service_user }}"
createhome=no createhome=no
shell=/bin/false shell=/bin/false
tags:
- install
- install:base
- name: create supervisor directories - name: create supervisor directories
file: > file: >
name={{ item }} name={{ item }}
...@@ -72,6 +78,9 @@ ...@@ -72,6 +78,9 @@
with_items: with_items:
- "{{ supervisor_app_dir }}" - "{{ supervisor_app_dir }}"
- "{{ supervisor_venv_dir }}" - "{{ supervisor_venv_dir }}"
tags:
- install
- install:base
- name: create service user accessible dirs - name: create service user accessible dirs
file: > file: >
...@@ -83,6 +92,9 @@ ...@@ -83,6 +92,9 @@
with_items: with_items:
- "{{ supervisor_cfg_dir }}" - "{{ supervisor_cfg_dir }}"
- "{{ supervisor_available_dir }}" - "{{ supervisor_available_dir }}"
tags:
- install
- install:base
- name: create supervisor directories - name: create supervisor directories
file: > file: >
...@@ -93,13 +105,18 @@ ...@@ -93,13 +105,18 @@
with_items: with_items:
- "{{ supervisor_data_dir }}" - "{{ supervisor_data_dir }}"
- "{{ supervisor_log_dir }}" - "{{ supervisor_log_dir }}"
tags:
- install
- install:base
- name: install supervisor in its venv - name: install supervisor in its venv
pip: > pip: >
name=supervisor virtualenv="{{ supervisor_venv_dir }}" state=present name=supervisor virtualenv="{{ supervisor_venv_dir }}" state=present
extra_args="-i {{ COMMON_PYPI_MIRROR_URL }}" extra_args="-i {{ COMMON_PYPI_MIRROR_URL }}"
sudo_user: "{{ supervisor_user }}" sudo_user: "{{ supervisor_user }}"
tags:
- install
- install:base
- name: install supervisor in its venv - name: install supervisor in its venv
pip: > pip: >
...@@ -107,11 +124,17 @@ ...@@ -107,11 +124,17 @@
extra_args="-i {{ COMMON_PYPI_MIRROR_URL }}" extra_args="-i {{ COMMON_PYPI_MIRROR_URL }}"
sudo_user: "{{ supervisor_user }}" sudo_user: "{{ supervisor_user }}"
with_items: supervisor_pip_pkgs with_items: supervisor_pip_pkgs
tags:
- install
- install:base
- name: create supervisor upstart job - name: create supervisor upstart job
template: > template: >
src=etc/init/supervisor-upstart.conf.j2 dest=/etc/init/{{ supervisor_service }}.conf src=etc/init/supervisor-upstart.conf.j2 dest=/etc/init/{{ supervisor_service }}.conf
owner=root group=root owner=root group=root
tags:
- install
- install:base
# This script is aws specific and looks up instances # This script is aws specific and looks up instances
# tags and enables services based on the 'services' tag # tags and enables services based on the 'services' tag
...@@ -121,6 +144,9 @@ ...@@ -121,6 +144,9 @@
src=etc/init/pre_supervisor.conf.j2 dest=/etc/init/pre_supervisor.conf src=etc/init/pre_supervisor.conf.j2 dest=/etc/init/pre_supervisor.conf
owner=root group=root owner=root group=root
when: supervisor_service == "supervisor" and disable_edx_services and not devstack when: supervisor_service == "supervisor" and disable_edx_services and not devstack
tags:
- to-remove
- aws-specfic
- name: write the pre_suprevisor python script - name: write the pre_suprevisor python script
copy: > copy: >
...@@ -130,12 +156,18 @@ ...@@ -130,12 +156,18 @@
owner={{ supervisor_user }} owner={{ supervisor_user }}
group={{ supervisor_service_user }} group={{ supervisor_service_user }}
when: disable_edx_services when: disable_edx_services
tags:
- to-remove
- aws-specfic
- name: create supervisor master config - name: create supervisor master config
template: > template: >
src=edx/app/supervisor/supervisord.conf.j2 dest={{ supervisor_cfg }} src=edx/app/supervisor/supervisord.conf.j2 dest={{ supervisor_cfg }}
owner={{ supervisor_user }} group={{ supervisor_service_user }} owner={{ supervisor_user }} group={{ supervisor_service_user }}
mode=0644 mode=0644
tags:
- install
- install:configuration
- name: create a symlink for supervisortctl - name: create a symlink for supervisortctl
# these links are deprecated in favor of the shell wrapper # these links are deprecated in favor of the shell wrapper
...@@ -144,7 +176,10 @@ ...@@ -144,7 +176,10 @@
dest={{ COMMON_BIN_DIR }}/{{ supervisor_ctl|basename }} dest={{ COMMON_BIN_DIR }}/{{ supervisor_ctl|basename }}
state=absent state=absent
when: supervisor_service == "supervisor" when: supervisor_service == "supervisor"
tags:
- install
- install:configuration
- name: create a symlink for supervisor cfg - name: create a symlink for supervisor cfg
# these links are deprecated in favor of the shell wrapper # these links are deprecated in favor of the shell wrapper
file: > file: >
...@@ -155,6 +190,9 @@ ...@@ -155,6 +190,9 @@
with_items: with_items:
- "{{ supervisor_cfg }}" - "{{ supervisor_cfg }}"
- "{{ supervisor_cfg_dir }}" - "{{ supervisor_cfg_dir }}"
tags:
- install
- install:configuration
- name: create helper script for running supervisor - name: create helper script for running supervisor
template: > template: >
...@@ -163,18 +201,27 @@ ...@@ -163,18 +201,27 @@
owner={{ supervisor_service_user }} owner={{ supervisor_service_user }}
mode=0755 mode=0755
when: supervisor_service == "supervisor" when: supervisor_service == "supervisor"
tags:
- install
- install:configuration
- name: start supervisor - name: start supervisor
service: > service: >
name={{ supervisor_service }} name={{ supervisor_service }}
state=started state=started
register: start_supervisor register: start_supervisor
tags:
- manage
- manager:start
# calling update on supervisor too soon after it # calling update on supervisor too soon after it
# starts will result in an errror. # starts will result in an errror.
- name: wait for web port to be available - name: wait for web port to be available
wait_for: port={{ supervisor_http_bind_port }} timeout=5 wait_for: port={{ supervisor_http_bind_port }} timeout=5
when: start_supervisor.changed when: start_supervisor.changed
tags:
- manage
- manage:start
# call supervisorctl update every time, this reloads # call supervisorctl update every time, this reloads
# the supervisorctl config # the supervisorctl config
...@@ -186,3 +233,6 @@ ...@@ -186,3 +233,6 @@
shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update" shell: "{{ supervisor_ctl }} -c {{ supervisor_cfg }} update"
register: supervisor_update register: supervisor_update
changed_when: supervisor_update.stdout is defined and supervisor_update.stdout != "" changed_when: supervisor_update.stdout is defined and supervisor_update.stdout != ""
tags:
- manage
- manage:start
\ No newline at end of file
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://github.com/edx/configuration/wiki
# code style: https://github.com/edx/configuration/wiki/Ansible-Coding-Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
##
# Defaults for role vhost
#
#
# vars are namespace with the module name.
#
vhost_role_name: vhost
#
# OS packages
#
vhost_debian_pkgs: []
vhost_redhat_pkgs: []
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://github.com/edx/configuration/wiki
# code style: https://github.com/edx/configuration/wiki/Ansible-Coding-Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
##
# Role includes for role vhost
#
# Example:
#
# dependencies:
# - {
# role: my_role
# my_role_var0: "foo"
# my_role_var1: "bar"
# }
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://github.com/edx/configuration/wiki
# code style: https://github.com/edx/configuration/wiki/Ansible-Coding-Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
#
#
# Tasks for role vhost
#
# Overview:
#
#
# Dependencies:
#
#
# Example play:
#
#
- name: add ssh-warning banner motd
template: >
dest=/etc/motd.tail
src={{ COMMON_MOTD_TEMPLATE }} mode=0755 owner=root group=root
- name: update ssh config
template: >
dest=/etc/ssh/sshd_config
src=sshd_config.j2 mode=0644 owner=root group=root
notify: restart ssh
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