Commit 73545e9a by Arbab Nazar

Merge pull request #3080 from edx/arbab/edxapp-python-rewrite

use the YAML style parameter passing
parents 6e7fb883 ea873168
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
tags: tags:
- install - install
- install:base - install:base
- name: create edxapp log dir - name: create edxapp log dir
file: file:
path: "{{ edxapp_log_dir }}" path: "{{ edxapp_log_dir }}"
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
tags: tags:
- install - install
- install:base - install:base
- name: create web-writable edxapp data dirs - name: create web-writable edxapp data dirs
file: file:
path: "{{ item }}" path: "{{ item }}"
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
tags: tags:
- install - install
- install:base - 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: apt_repository:
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
tags: tags:
- install - install
- install:base - install:base
- name: install system packages on which LMS and CMS rely - name: install system packages on which LMS and CMS rely
apt: apt:
name: "{{ item }}" name: "{{ item }}"
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
tags: tags:
- install - install
- install:base - install:base
- name: set up edxapp .npmrc - name: set up edxapp .npmrc
template: template:
src: .npmrc.j2 src: .npmrc.j2
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
tags: tags:
- install - install
- install:base - install:base
- name: create log directories for service variants - name: create log directories for service variants
file: file:
path: "{{ edxapp_log_dir }}/{{ item }}" path: "{{ edxapp_log_dir }}/{{ item }}"
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
tags: tags:
- install - install
- install:base - install:base
# Set up the python sandbox execution environment # Set up the python sandbox execution environment
- include: python_sandbox_env.yml - include: python_sandbox_env.yml
when: EDXAPP_PYTHON_SANDBOX when: EDXAPP_PYTHON_SANDBOX
...@@ -124,5 +124,5 @@ ...@@ -124,5 +124,5 @@
- deploy - deploy
- include: deploy.yml - include: deploy.yml
tags: tags:
- deploy - deploy
---
# Set the alternatives this way for blas and lapack to work correctly for the # Set the alternatives this way for blas and lapack to work correctly for the
# MITx 6.341x course. # MITx 6.341x course.
- name: code sandbox | Check which `libblas` to use - name: code sandbox | Check which `libblas` to use
# The `libblas.so.3gf` exists only in 12.04 stat:
stat: path=/usr/lib/libblas/libblas.so.3gf path: /usr/lib/libblas/libblas.so.3gf
register: libblas_file register: libblas_file
- name: code sandbox | Use libblas.so.3gf in Ubuntu 12.04 - name: code sandbox | Use libblas.so.3gf in Ubuntu
alternatives: name=libblas.so.3gf path=/usr/lib/libblas/libblas.so.3gf alternatives:
name: libblas.so.3gf
path: /usr/lib/libblas/libblas.so.3gf
when: libblas_file.stat.exists when: libblas_file.stat.exists
- name: code sandbox | Use libblas.so.3 in Ubuntu 14.04 - name: code sandbox | Use libblas.so.3 in Ubuntu
alternatives: name=libblas.so.3 path=/usr/lib/libblas/libblas.so.3 alternatives:
name: libblas.so.3
path: /usr/lib/libblas/libblas.so.3
when: not libblas_file.stat.exists when: not libblas_file.stat.exists
- name: code sandbox | Check which `liblapac` to use - name: code sandbox | Check which `liblapac` to use
# The `liblapack.so.3gf` exists only in 12.04 stat:
stat: path=/usr/lib/lapack/liblapack.so.3gf path: /usr/lib/lapack/liblapack.so.3gf
register: liblapack_file register: liblapack_file
- name: code sandbox | Use liblapack.so.3gf in Ubuntu 12.04 - name: code sandbox | Use liblapack.so.3gf in Ubuntu
alternatives: name=liblapack.so.3gf path=/usr/lib/lapack/liblapack.so.3gf alternatives:
name: liblapack.so.3gf
path: /usr/lib/lapack/liblapack.so.3gf
when: liblapack_file.stat.exists when: liblapack_file.stat.exists
- name: code sandbox | Use liblapack.so.3 in Ubuntu 14.04 - name: code sandbox | Use liblapack.so.3 in Ubuntu
alternatives: name=liblapack.so.3 path=/usr/lib/lapack/liblapack.so.3 alternatives:
name: liblapack.so.3
path: /usr/lib/lapack/liblapack.so.3
when: not liblapack_file.stat.exists when: not liblapack_file.stat.exists
- name: code sandbox | Create edxapp sandbox user - name: code sandbox | Create edxapp sandbox user
user: name={{ edxapp_sandbox_user }} shell=/bin/false home={{ edxapp_sandbox_venv_dir }} user:
name: "{{ edxapp_sandbox_user }}"
shell: /bin/false
home: "{{ edxapp_sandbox_venv_dir }}"
tags: tags:
- edxapp-sandbox - edxapp-sandbox
- name: code sandbox | Install apparmor utils system pkg - name: code sandbox | Install apparmor utils system pkg
apt: pkg=apparmor-utils state=present apt:
name: apparmor-utils
state: present
tags: tags:
- edxapp-sandbox - edxapp-sandbox
- name: code sandbox | write out apparmor code sandbox config - name: code sandbox | write out apparmor code sandbox config
template: src=code.sandbox.j2 dest=/etc/apparmor.d/code.sandbox mode=0644 owner=root group=root template:
src: code.sandbox.j2
dest: /etc/apparmor.d/code.sandbox
mode: 0644
owner: root
group: root
tags: tags:
- edxapp-sandbox - edxapp-sandbox
- name: code sandbox | write out sandbox user sudoers config - name: code sandbox | write out sandbox user sudoers config
template: src=95-sandbox-sudoer.j2 dest=/etc/sudoers.d/95-{{ edxapp_sandbox_user }} mode=0440 owner=root group=root validate='visudo -c -f %s' template:
src: 95-sandbox-sudoer.j2
dest: "/etc/sudoers.d/95-{{ edxapp_sandbox_user }}"
mode: 0440
owner: root
group: root
validate: 'visudo -c -f %s'
tags: tags:
- edxapp-sandbox - edxapp-sandbox
# we boostrap and enable the apparmor service here. in deploy.yml we disable, deploy, then re-enable # we boostrap and enable the apparmor service here. In deploy.yml we disable, deploy, then re-enable
# so we need to enable it in main.yml # so we need to enable it in main.yml
- name: code sandbox | start apparmor service - name: code sandbox | start apparmor service
service: name=apparmor state=started service:
name: apparmor
state: started
tags: tags:
- edxapp-sandbox - edxapp-sandbox
- name: code sandbox | (bootstrap) load code sandbox profile - name: code sandbox | (bootstrap) load code sandbox profile
command: apparmor_parser -r /etc/apparmor.d/code.sandbox command: apparmor_parser -r /etc/apparmor.d/code.sandbox
tags: tags:
- edxapp-sandbox - edxapp-sandbox
- name: code sandbox | (bootstrap) put code sandbox into aa-enforce or aa-complain mode depending on EDXAPP_SANDBOX_ENFORCE - name: code sandbox | (bootstrap) put code sandbox into aa-enforce or aa-complain mode depending on EDXAPP_SANDBOX_ENFORCE
command: /usr/sbin/{{ edxapp_aa_command }} /etc/apparmor.d/code.sandbox command: /usr/sbin/{{ edxapp_aa_command }} /etc/apparmor.d/code.sandbox
tags: tags:
- edxapp-sandbox - edxapp-sandbox
--- ---
- name: get instance information - name: get instance information
action: ec2_facts action: ec2_facts
- name: tag instance with edx_platform version - name: tag instance with edx_platform version
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:edx_platform" : "{{ edx_platform_repo }} {{ edxapp_platform_checkout.after|truncate(7,True,'') }}" "version:edx_platform" : "{{ edx_platform_repo }} {{ edxapp_platform_checkout.after|truncate(7,True,'') }}"
when: edxapp_platform_checkout.after is defined when: edxapp_platform_checkout.after is defined
- name: tag instance with edxapp theme version - name: tag instance with edxapp theme version
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:edxapp_theme" : "{{ edxapp_theme_source_repo }} {{ edxapp_theme_checkout.after|truncate(7,True,'') }}" "version:edxapp_theme" : "{{ edxapp_theme_source_repo }} {{ edxapp_theme_checkout.after|truncate(7,True,'') }}"
when: edxapp_theme_checkout.after is defined when: edxapp_theme_checkout.after is defined
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