<commit_before># requires:
#  - group_vars/all
#  - common/tasks/main.yml
---
- name: create application user
  user: >
    name="{{ edxapp_user }}" home="{{ edxapp_app_dir }}"
    createhome=no shell=/bin/false

- name: create edxapp user dirs
  file: >
    path="{{ item }}" state=directory
    owner="{{ edxapp_user }}" group="{{ common_web_group }}"
  with_items:
    - "{{ edxapp_app_dir }}"
    # needed for the ansible 1.5 git module
    - "{{ edxapp_app_dir }}/.ssh"
    - "{{ edxapp_venvs_dir }}"
    - "{{ edxapp_theme_dir }}"
    - "{{ edxapp_staticfile_dir }}"
    - "{{ edxapp_course_static_dir }}"
    - "{{ edxapp_course_data_dir }}"

# var should have more permissive permissions than the rest
- name: create edxapp var dir
  file: >
    path={{ edxapp_data_dir }} state=directory mode=0775
    owner="{{ edxapp_user }}" group="{{ common_web_group }}"

# This is a symlink that has to exist because
# we currently can't override the DATA_DIR var
# in edx-platform. TODO: This can be removed once
# VPC-122 is closed
- name: make the course data dir
  file:
    src="{{ edxapp_course_data_dir }}"
    dest="{{ edxapp_legacy_course_data_dir }}"
    state=link
    owner="{{ edxapp_user }}"
    group="{{ common_web_group }}"

- name: create edxapp log dir
  file: >
    path="{{ edxapp_log_dir }}" state=directory
    owner="{{ common_log_user }}" group="{{ common_log_user }}"

- name: create web-writable edxapp data dirs
  file: >
    path="{{ item }}" state=directory
    owner="{{ common_web_user }}" group="{{ edxapp_user }}"
    mode="0775"
  with_items:
    - "{{ edxapp_course_data_dir }}"
    - "{{ edxapp_upload_dir }}"

# adding chris-lea nodejs repo
- name: add ppas for current versions of nodejs
  apt_repository: repo="{{ edxapp_chrislea_ppa }}"

- name: install system packages on which LMS and CMS rely
  apt: pkg={{','.join(edxapp_debian_pkgs)}} state=present update_cache=yes

- name: set up edxapp .npmrc<commit_msg>Create writable media dir on local filesystem<commit_after># requires:
#  - group_vars/all
#  - common/tasks/main.yml
---
- name: create application user
  user: >
    name="{{ edxapp_user }}" home="{{ edxapp_app_dir }}"
    createhome=no shell=/bin/false

- name: create edxapp user dirs
  file: >
    path="{{ item }}" state=directory
    owner="{{ edxapp_user }}" group="{{ common_web_group }}"
  with_items:
    - "{{ edxapp_app_dir }}"
    # needed for the ansible 1.5 git module
    - "{{ edxapp_app_dir }}/.ssh"
    - "{{ edxapp_venvs_dir }}"
    - "{{ edxapp_theme_dir }}"
    - "{{ edxapp_staticfile_dir }}"
    - "{{ edxapp_course_static_dir }}"
    - "{{ edxapp_course_data_dir }}"

# var should have more permissive permissions than the rest
- name: create edxapp var dir
  file: >
    path={{ edxapp_data_dir }} state=directory mode=0775
    owner="{{ edxapp_user }}" group="{{ common_web_group }}"

# This is a symlink that has to exist because
# we currently can't override the DATA_DIR var
# in edx-platform. TODO: This can be removed once
# VPC-122 is closed
- name: make the course data dir
  file:
    src="{{ edxapp_course_data_dir }}"
    dest="{{ edxapp_legacy_course_data_dir }}"
    state=link
    owner="{{ edxapp_user }}"
    group="{{ common_web_group }}"

- name: create edxapp log dir
  file: >
    path="{{ edxapp_log_dir }}" state=directory
    owner="{{ common_log_user }}" group="{{ common_log_user }}"

- name: create web-writable edxapp data dirs
  file: >
    path="{{ item }}" state=directory
    owner="{{ common_web_user }}" group="{{ edxapp_user }}"
    mode="0775"
  with_items:
    - "{{ edxapp_course_data_dir }}"
    - "{{ edxapp_upload_dir }}"
    - "{{ edxapp_media_dir }}"

# adding chris-lea nodejs repo
- name: add ppas for current versions of nodejs
  apt_repository: repo="{{ edxapp_chrislea_ppa }}"

- name: install system packages on which LMS and CMS rely
  apt: pkg={{','.join(edxapp_debian_pkgs)}} state=present update_cache=yes

- name: set up edxapp .npmrc
{'fraction_non_alphanumeric': 0.14653215636822195, 'fraction_numerical': 0.006557377049180328, 'mean_word_length': 3.6549295774647885, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5270390', 'n_tokens_mistral': 1427, 'n_tokens_neox': 1395, 'n_words': 356}