Commit 01845083 by Jason Bau

Merge pull request #65 from edx/feature/jrbl/tagging_update_install

Feature/jrbl/tagging update install
parents 0178d755 32fb82af
......@@ -8,12 +8,14 @@
tags:
- cms-env
- cms
- update
- name: create cms auth file
template: src=auth.json.j2 dest=$app_base_dir/cms.auth.json mode=640 owner=www-data group=adm
tags:
- cms-env
- cms
- update
- include: ../../nginx/tasks/nginx_site.yml state=link site_name=cms
......@@ -25,6 +27,7 @@
- cms
- cms-env
- logging
- update
# If we set up CMS, we have to set up edx logging
- include: ../../common/tasks/edx_logging_base.yml
......
......@@ -4,6 +4,7 @@
tags:
- users
- admin_users
- update
- name: Add user 'ubuntu' to 'edx' group
# This is a temporary measure for initial configuration; after the last
......@@ -12,6 +13,7 @@
tags:
- users
- admin_users
- update
- name: Creating admin users
# Admin users, by definition, should be able to sudo w/ password, and read adm-only files
......@@ -21,6 +23,7 @@
tags:
- users
- admin_users
- update
- name: Copying ssh keys for admin users
authorized_key: user={{ item.user }} key="{{lookup('file', item.path)}}"
......@@ -28,6 +31,7 @@
tags:
- users
- admin_users
- update
- name: Creating env users
user: name={{ item.user }} groups={{ ",".join(item.groups) }} shell=/bin/bash
......@@ -35,6 +39,7 @@
when: env_users is defined
tags:
- users
- update
- name: Copying ssh keys for env users
authorized_key: user={{ item.user }} key="{{lookup('file', item.path)}}"
......@@ -42,10 +47,12 @@
when: env_keys is defined
tags:
- users
- update
- name: Group adm passwordless sudo
copy: content="%adm ALL=(ALL) NOPASSWD:ALL" dest=/etc/sudoers.d/adm-group owner=root group=root mode=0440
tags:
- users
- admin_users
- update
......@@ -4,19 +4,28 @@
easy_install: name=pip
tags:
- venv_base
- install
- name: pip install virtualenv
pip: name=virtualenv state=latest
tags:
- venv_base
- install
- name: pip install virtualenvwrapper
pip: name=virtualenvwrapper state=latest
tags:
- venv_base
- install
- name: create edx virtualenv directory
file: path=$venv_dir owner=ubuntu group=adm mode=2775 state=directory
tags:
- venv_base
- install
- name: create the edx virtualenv directory initial contents
command: /usr/local/bin/virtualenv $venv_dir creates=$venv_dir/bin/activate
tags:
- venv_base
- install
......@@ -4,23 +4,28 @@
notify: restart rsyslogd
tags:
- logging
- update
- name: Install logrotate configuration for edX
template: dest=/etc/logrotate.d/edx-services src=edx_logrotate.j2 owner=root group=root mode=644
tags:
- logging
- update
- name: Touch tracking file into existence
command: touch -a {{log_base_dir}}/tracking.log creates={{log_base_dir}}/tracking.log
tags:
- logging
- update
- name: Set permissions on tracking file
file: path={{log_base_dir}}/tracking.log owner=syslog group=adm mode=640
tags:
- logging
- update
- name: Install logrotate configuration for tracking file
template: dest=/etc/logrotate.d/tracking.log src=edx_logrotate_tracking_log.j2 owner=root group=root mode=644
tags:
- logging
- update
---
- include: create_users.yml
- name: Create application root
# In the future consider making group edx r/t adm
file: path=$app_base_dir state=directory owner=root group=adm mode=2775
tags:
- pre_install
- update
- name: Create upload directory
file: path=$app_base_dir/uploads mode=2775 state=directory owner=root group=adm
tags:
- pre_install
- update
- name: Create data dir
file: path={{ app_base_dir }}/data state=directory owner=root group=root
tags:
- pre_install
- update
- name: Install role-independent useful system packages
# do this before log dir setup; rsyslog package guarantees syslog user present
......@@ -29,23 +33,27 @@
- tree
tags:
- pre_install
- update
- name: Create log directory
file: path=$log_base_dir state=directory mode=2770 group=adm owner=syslog
tags:
- pre_install
- update
- name: Create alias from app_base_dir to the log_base_dir
file: state=link src=$log_base_dir path=$app_base_dir/log
tags:
- pre_install
- logging
- update
- name: Create convenience link from log_base_dir to system logs
file: state=link src=/var/log path=$log_base_dir/system
tags:
- pre_install
- logging
- update
- name: Touch edx log file into place
# This is done for the benefit of the rake commands, which expect it
......@@ -53,6 +61,7 @@
tags:
- pre_install
- logging
- install
- name: Set permissions on edx log file
# This is done for the benefit of the rake commands, which expect it
......@@ -60,6 +69,7 @@
tags:
- pre_install
- logging
- update
- include: create_venv.yml
- include: edx_logging_base.yml
......
......@@ -2,4 +2,5 @@
- name: edx-update.sh, manual lms/cms update script
copy: src=roles/common/files/edx-update.sh dest=/usr/local/bin/edx-update.sh owner=ubuntu group=adm mode=0775
tags:
- release
- update
......@@ -3,3 +3,4 @@
pip: name=gunicorn virtualenv="{{venv_dir}}" state=present
tags:
- gunicorn
- install
......@@ -10,3 +10,4 @@
tags:
- upstart
- gunicorn
- update
......@@ -9,10 +9,30 @@
- name: Make sure LMS is running
service: name=lms state=started
tags:
- lms
- lms-env
- production
- update
- name: Make sure CMS is running
service: name=cms state=started
tags:
- cms
- cms-env
- production
- update
- name: Make sure LMS-preview is running
service: name=lms-preview state=started
tags:
- lms-preview
- lms-preview-env
- production
- update
- name: Disable HTTP Basic Auth on site
file: path=/etc/nginx/sites-enabled/basic-auth state=absent
notify: restart nginx
tags:
- production
- update
......@@ -8,12 +8,14 @@
tags:
- lms
- lms-env
- update
- name: create lms auth file
template: src=auth.json.j2 dest=$app_base_dir/lms.auth.json mode=640 owner=www-data group=adm
tags:
- lms
- lms-env
- update
- include: ../../nginx/tasks/nginx_site.yml state=link site_name=lms
- include: ../../nginx/tasks/nginx_site.yml state=link site_name=lms-backend
......@@ -24,6 +26,7 @@
- cms
- lms
- lms-env
- update
- name: Create lms log target directory
file: path={{log_base_dir}}/lms state=directory owner=syslog group=adm mode=2770
......@@ -31,6 +34,7 @@
- lms
- lms-env
- logging
- update
# If we set up LMS, we have to set up edx logging
- include: ../../common/tasks/edx_logging_base.yml
......@@ -45,12 +49,14 @@
tags:
- lms
- cms
- update
- name: upload ssh script
copy: src=git_ssh.sh dest=/tmp/git_ssh.sh force=yes owner=root group=adm mode=750
tags:
- lms
- cms
- update
# Check out mitx repo to $app_base_dir
- name: install git and its recommends
......@@ -58,13 +64,15 @@
tags:
- lms
- cms
- name: git checkout mitx repo into $app_base_dir
git: dest={{app_base_dir}}/mitx repo={{lms_source_repo}}
- name: git checkout edx-platform repo into $app_base_dir
git: dest={{platform_code_dir}} repo={{lms_source_repo}}
environment:
GIT_SSH: /tmp/git_ssh.sh
tags:
- lms
- cms
- install
## Install the debian package requirements system-wide
- name: store remote apt_repos list for ansible use
......@@ -73,6 +81,8 @@
tags:
- lms
- cms
- install
- name: add apt_repos to the remote hosts
apt_repository: repo="$item"
with_items: "{{apt_repos_list.stdout.split()}}"
......@@ -81,6 +91,8 @@
tags:
- lms
- cms
- install
- name: update apt cache (if necessary)
apt: update_cache=yes
sudo: True
......@@ -88,18 +100,23 @@
tags:
- lms
- cms
- install
- name: store remote apt_packages list for ansible use
command: cat {{app_base_dir}}/mitx/apt-packages.txt
register: apt_packages_list
tags:
- lms
- cms
- install
- name: install a bunch of system packages on which LMS and CMS rely
apt: pkg={{item}} state=present
with_items: lms_debian_pkgs
tags:
- lms
- cms
- install
# Install the python requirements into $venv_dir
- name : install python pre-requirements
......@@ -107,6 +124,7 @@
tags:
- lms
- cms
- install
# Install the python modules into $venv_dir
- name : install python packages using the shell
......@@ -118,6 +136,7 @@
tags:
- lms
- cms
- install
# Creates LMS upstart file
- include: ../../gunicorn/tasks/upstart.yml service_variant=lms
......@@ -6,6 +6,7 @@
notify: restart nginx
tags:
- nginx
- install
# Standard configuration that is common across all roles
# Default values for these variables are set in group_vars/all
......@@ -17,12 +18,14 @@
copy: content={{ nginx_cfg.htpasswd }} dest=/etc/nginx/nginx.htpasswd
tags:
- nginx
- update
- name: Create nginx log file location (just in case)
file: path={{log_base_dir}}/nginx state=directory owner=syslog group=adm mode=2770
tags:
- nginx
- logging
- update
# removing default link
- name: Removing default nginx config and restart (enabled)
......@@ -30,11 +33,13 @@
notify: restart nginx
tags:
- nginx
- update
- name: Ensuring that nginx is running
service: name=nginx state=started
tags:
- nginx
- update
# Note that nginx logs to /var/log until it reads its configuration, so /etc/logrotate.d/nginx is still good
......@@ -42,14 +47,17 @@
template: dest=/etc/logrotate.d/nginx-access src=edx_logrotate_nginx_access.j2 owner=root group=root mode=644
tags:
- logging
- update
- name: Set up nginx access log rotation
template: dest=/etc/logrotate.d/nginx-error src=edx_logrotate_nginx_error.j2 owner=root group=root mode=644
tags:
- logging
- update
- name: Removing default nginx config (available)
file: path=/etc/nginx/sites-available/default state=absent
tags:
- nginx
- update
......@@ -12,6 +12,7 @@
- lms
- cms
- nginx-env
- update
- name: Creating nginx config link {{ site_name }}
file: src=/etc/nginx/sites-available/{{ site_name }} dest=/etc/nginx/sites-enabled/{{ site_name }} state={{ state }} owner=root group=root
......@@ -21,3 +22,4 @@
- lms
- cms
- nginx-env
- update
......@@ -6,9 +6,11 @@
apt: pkg=nodejs state=present install_recommends=no
tags:
- npm
- install
- name: Install mitx npm dependencies
shell: npm install chdir=${app_base_dir}/mitx
tags:
- npm
- update
......@@ -4,10 +4,14 @@
user: name=www state=present
tags:
- ruby
- update
- name: Create ruby base
file: path=$ruby_base state=directory owner=www group=www
tags:
- ruby
- update
- name: rbenv | install build depends
apt: pkg=$item state=present install_recommends=no
with_items:
......@@ -22,21 +26,25 @@
- zlib1g-dev
tags:
- ruby
- install
- name: rbenv | update rbenv repo
git: repo=git://github.com/sstephenson/rbenv.git dest=$rbenv_root version=v0.4.0
tags:
- ruby
- install
- name: rbenv | add rbenv to path
file: path=/usr/local/bin/rbenv src=${rbenv_root}/bin/rbenv state=link
tags:
- ruby
- update
- name: rbenv | add rbenv initialization to profile
template: src=rbenv.sh.j2 dest=/etc/profile.d/rbenv.sh owner=root group=root mode=0755
tags:
- ruby
- update
- name: rbenv | check ruby-build installed
command: test -x /usr/local/bin/ruby-build
......@@ -44,6 +52,7 @@
ignore_errors: yes
tags:
- ruby
- install
- name: rbenv | create temporary directory
command: mktemp -d
......@@ -51,24 +60,28 @@
when_failed: $rbuild_present
tags:
- ruby
- install
- name: rbenv | clone ruby-build repo
git: repo=git://github.com/sstephenson/ruby-build.git dest=${tempdir.stdout}/ruby-build
when_failed: $rbuild_present
tags:
- ruby
- install
- name: rbenv | install ruby-build
command: ./install.sh chdir=${tempdir.stdout}/ruby-build
when_failed: $rbuild_present
tags:
- ruby
- install
- name: rbenv | remove temporary directory
file: path=${tempdir.stdout} state=absent
when_failed: $rbuild_present
tags:
- ruby
- install
- name: rbenv | check ruby $ruby_version installed
shell: RBENV_ROOT=${rbenv_root} rbenv versions | grep $ruby_version
......@@ -76,31 +89,37 @@
ignore_errors: yes
tags:
- ruby
- install
- name: rbenv | install ruby $ruby_version
shell: RBENV_ROOT=${rbenv_root} rbenv install $ruby_version
when_failed: $ruby_installed
tags:
- ruby
- install
- name: rbenv | set global ruby $ruby_version
shell: RBENV_ROOT=${rbenv_root} rbenv global $ruby_version
when_failed: $ruby_installed
tags:
- ruby
- install
- name: rbenv | rehash
shell: RBENV_ROOT=${rbenv_root} rbenv rehash
when_failed: $ruby_installed
tags:
- ruby
- install
- name: gem | gem install bundler
shell: RBENV_ROOT=${rbenv_root} GEM_HOME=${gem_home} ${rbenv_root}/shims/gem install bundle chdir=${app_base_dir}/mitx
tags:
- ruby
- install
- name: bundle | bundle install
shell: RBENV_ROOT=${rbenv_root} GEM_HOME=${gem_home} ${gem_home}/bin/bundle install --binstubs chdir=${app_base_dir}/mitx
tags:
- ruby
- install
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