<commit_before># Ansible playbook
#
# To provision:
#    ansible-playbook -i <inventory> playbook.yml
#
# VERSION 0.1
# ANSIBLE-VERSION 1.2.2

- hosts: vagrant
  user: vagrant
  sudo: True

  tasks:
    - user: name=ansible groups=admin shell=/bin/bash password=ansible state=present
    - file: path=/etc/sudoers.d mode=0770 owner=root group=root state=directory
    - copy: src=files/etc/sudoers dest=/etc/sudoers mode=0440 owner=root group=root
    - command: cat /home/vagrant/.ssh/authorized_keys
      register: authorized_keys
    - authorized_key: user=ansible key="{{ item }}"
      with_items: authorized_keys.stdout_lines


- hosts: app
  user: ansible
  sudo: True

  tasks:
    - name: update apt
      apt: update_cache=yes

    - name: install apt packages
      apt: pkg=$item
      with_items:
        - build-essential
        - python
        - python-dev
        - python-setuptools
        - python-pip
        - python-numpy
        - python-opencv
        - libjpeg-dev
        - libfreetype6-dev
        - zlib1g-dev
        - libwebp-dev
        - liblcms2-dev

    - name: install pip packages
      pip: >
        name={{ item.name }}
        version={{ item.version }}
        use_mirrors=yes
      with_items:
        - { name: 'Pillow', version: '2.4.0' }
        - { name: 'tornado', version: '3.2.1' }
        - { name: 'coverage', version: '3.6' }
        - { name: 'pep8', version: '1.4.6' }
        - { name: 'pyflakes', version: '0.7.3' }
        - { name: 'pyandoc', version: '0.0.1' }
        - { name: 'sphinx-me', version: '0.2.1' }


- hosts: app:!web
  user: ansible
  sudo: True

  tasks:
    - name: copy pilbox init script
      copy: src=files/etc/init.d/pilbox dest=/etc/init.d/pilbox mode=0755
      notify:
        - restart pilbox

    - name: install pilbox init script
      command: update-rc.d pilbox defaults

    - name: running pilbox check
      service: name=pilbox state=running enabled=yes

  handlers:
    - name: restart pilbox
      service: name=pilbox state=restarted


- hosts: web
  user: ansible
  sudo: True

  tasks:
    - name: update apt
      apt: update_cache=yes

    - name: install apt packages
      apt: pkg=$item
      with_items:
        - build-essential
        - nginx-light
        - supervisor
        - varnish

    - file: path=/var/log/supervisor mode=0755 state=directory

    - name: copy default varnish
      copy: src=files/etc/default/varnish dest=/etc/default/varnish mode=0644

    - name: copy varnish vcl
      copy: src=files/etc/varnish/default.vcl dest=/etc/varnish/default.vcl mode=0644

    - name: copy varnish executable
      copy: src=files/usr/local/bin/varnish.sh dest=/usr/local/bin/varnish.sh mode=0755

    - name: copy nginx configuration
      copy: src=files/etc/nginx/nginx.conf dest=/etc/nginx/nginx.conf mode=0644

    - name: copy supervisor configuration
      copy: >
        src=files/etc/supervisor/conf.d/supervisord.conf
        dest=/etc/supervisor/conf.d/supervisord.conf
        mode=0644<commit_msg>Fixed apt installs in provisioning to support newer versions of ansible<commit_after># Ansible playbook
#
# To provision:
#    ansible-playbook -i <inventory> playbook.yml
#
# VERSION 0.1
# ANSIBLE-VERSION 1.2.2

- hosts: vagrant
  user: vagrant
  sudo: True

  tasks:
    - user: name=ansible groups=admin shell=/bin/bash password=<PASSWORD> state=present
    - file: path=/etc/sudoers.d mode=0770 owner=root group=root state=directory
    - copy: src=files/etc/sudoers dest=/etc/sudoers mode=0440 owner=root group=root
    - command: cat /home/vagrant/.ssh/authorized_keys
      register: authorized_keys
    - authorized_key: user=ansible key="{{ item }}"
      with_items: authorized_keys.stdout_lines


- hosts: app
  user: ansible
  sudo: True

  tasks:
    - name: update apt
      apt: update_cache=yes cache_valid_time=3600

    - name: install apt packages
      apt: name="{{ item }}"
      with_items:
        - build-essential
        - python
        - python-dev
        - python-setuptools
        - python-pip
        - python-numpy
        - python-opencv
        - libjpeg-dev
        - libfreetype6-dev
        - zlib1g-dev
        - libwebp-dev
        - liblcms2-dev

    - name: install pip packages
      pip: >
        name={{ item.name }}
        version={{ item.version }}
        use_mirrors=yes
      with_items:
        - { name: 'Pillow', version: '2.4.0' }
        - { name: 'tornado', version: '3.2.1' }
        - { name: 'coverage', version: '3.6' }
        - { name: 'pep8', version: '1.4.6' }
        - { name: 'pyflakes', version: '0.7.3' }
        - { name: 'pyandoc', version: '0.0.1' }
        - { name: 'sphinx-me', version: '0.2.1' }


- hosts: app:!web
  user: ansible
  sudo: True

  tasks:
    - name: copy pilbox init script
      copy: src=files/etc/init.d/pilbox dest=/etc/init.d/pilbox mode=0755
      notify:
        - restart pilbox

    - name: install pilbox init script
      command: update-rc.d pilbox defaults

    - name: running pilbox check
      service: name=pilbox state=running enabled=yes

  handlers:
    - name: restart pilbox
      service: name=pilbox state=restarted


- hosts: web
  user: ansible
  sudo: True

  tasks:
    - name: update apt
      apt: update_cache=yes cache_valid_time=3600

    - name: install apt packages
      apt: name="{{ item }}"
      with_items:
        - build-essential
        - nginx-light
        - supervisor
        - varnish

    - file: path=/var/log/supervisor mode=0755 state=directory

    - name: copy default varnish
      copy: src=files/etc/default/varnish dest=/etc/default/varnish mode=0644

    - name: copy varnish vcl
      copy: src=files/etc/varnish/default.vcl dest=/etc/varnish/default.vcl mode=0644

    - name: copy varnish executable
      copy: src=files/usr/local/bin/varnish.sh dest=/usr/local/bin/varnish.sh mode=0755

    - name: copy nginx configuration
      copy: src=files/etc/nginx/nginx.conf dest=/etc/nginx/nginx.conf mode=0644

    - name: copy supervisor configuration
      copy: >
        src=files/etc/supervisor/conf.d/supervisord.conf
        dest=/etc/supervisor/conf.d/supervisord.conf
        mode=0644
{'fraction_non_alphanumeric': 0.11842743892574017, 'fraction_numerical': 0.02232648438763954, 'mean_word_length': 2.2281984334203657, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 10, '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': '1650303', 'n_tokens_mistral': 2234, 'n_tokens_neox': 2081, 'n_words': 471}