<commit_before>---
- name: add group varda
  group: name=varda state=present

- name: add user varda
  user: name=varda
        group=varda
        shell=/bin/bash
        state=present

- name: add .bashrc for user varda
  template: src=bashrc
            dest=/home/varda/.bashrc
            owner=varda
            group=varda

- name: install packages
  apt: pkg={{ item }} state=present
  with_items:
    - build-essential
    - git
    - netcat-openbsd
    - python-dev
    - python-virtualenv

- name: create the varda directories
  file: path=/opt/varda/{{ item }}
        owner=varda
        group=varda
        state=directory
  with_items:
    - ''
    - aule
    - data
    - genome
    - versions
    - src
    - src/aule

# TODO: Better to use the GitHub API and jq to get this URL. But to prevent
# lockout by rate limiting it should be authenticated.
- name: get aule distribution url
  shell: echo -n https://github.com; curl -sL https://github.com/varda/aule/releases | grep -oPm1 '(?<=href=")[^"]*dist.tar.gz'
  register: varda_aule_dist_url
  changed_when: false

- name: download aule distribution
  get_url:
    url: '{{ varda_aule_dist_url.stdout }}'
    dest: /opt/varda/src/aule/dist.tar.gz
    force: yes
  register: varda_aule_dist_download

- name: clean aule distribution
  file:
    path: /opt/varda/aule/dist
    state: absent
  when: varda_aule_dist_download.changed

- name: extract aule distribution
  unarchive:
    src: /opt/varda/src/aule/dist.tar.gz
    dest: /opt/varda/aule
    copy: no

- name: configure aule
  template:
    src: aule.html
    dest: /opt/varda/aule/index.html
    owner: varda
    group: varda

- name: checkout varda git repository
  git: repo={{ varda_git_repository }}
       dest=/opt/varda/src/varda
       version={{ varda_git_branch }}
       update=yes
  sudo_user: varda
  register: varda_code

- name: copy ssl certificate
  copy: src={{ varda_certificate}}
        dest=/etc/ssl/certs/varda.crt
  notify: reload nginx

- name: copy ssl certificate key
  copy: src={{ varda_certificate_key }}
        dest=/etc/ssl/private/varda.key
        owner=root
        group=root
        mode=0600
  notify: reload nginx
<commit_msg>Downloading Aulë requires curl<commit_after>---
- name: add group varda
  group: name=varda state=present

- name: add user varda
  user: name=varda
        group=varda
        shell=/bin/bash
        state=present

- name: add .bashrc for user varda
  template: src=bashrc
            dest=/home/varda/.bashrc
            owner=varda
            group=varda

- name: install packages
  apt: pkg={{ item }} state=present
  with_items:
    - build-essential
    - curl
    - git
    - netcat-openbsd
    - python-dev
    - python-virtualenv

- name: create the varda directories
  file: path=/opt/varda/{{ item }}
        owner=varda
        group=varda
        state=directory
  with_items:
    - ''
    - aule
    - data
    - genome
    - versions
    - src
    - src/aule

# TODO: Better to use the GitHub API and jq to get this URL. But to prevent
# lockout by rate limiting it should be authenticated.
- name: get aule distribution url
  shell: echo -n https://github.com; curl -sL https://github.com/varda/aule/releases | grep -oPm1 '(?<=href=")[^"]*dist.tar.gz'
  register: varda_aule_dist_url
  changed_when: false

- name: download aule distribution
  get_url:
    url: '{{ varda_aule_dist_url.stdout }}'
    dest: /opt/varda/src/aule/dist.tar.gz
    force: yes
  register: varda_aule_dist_download

- name: clean aule distribution
  file:
    path: /opt/varda/aule/dist
    state: absent
  when: varda_aule_dist_download.changed

- name: extract aule distribution
  unarchive:
    src: /opt/varda/src/aule/dist.tar.gz
    dest: /opt/varda/aule
    copy: no

- name: configure aule
  template:
    src: aule.html
    dest: /opt/varda/aule/index.html
    owner: varda
    group: varda

- name: checkout varda git repository
  git: repo={{ varda_git_repository }}
       dest=/opt/varda/src/varda
       version={{ varda_git_branch }}
       update=yes
  sudo_user: varda
  register: varda_code

- name: copy ssl certificate
  copy: src={{ varda_certificate}}
        dest=/etc/ssl/certs/varda.crt
  notify: reload nginx

- name: copy ssl certificate key
  copy: src={{ varda_certificate_key }}
        dest=/etc/ssl/private/varda.key
        owner=root
        group=root
        mode=0600
  notify: reload nginx

{'fraction_non_alphanumeric': 0.10579972813774355, 'fraction_numerical': 0.0022655188038060714, 'mean_word_length': 2.484609313338595, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3999595', 'n_tokens_mistral': 1601, 'n_tokens_neox': 1518, 'n_words': 386}