<commit_before>---
- name: install EPEL repo
  yum: name=https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm state=present

- name: install git
  yum: name=git
  when: "ansible_os_family == 'RedHat'"

- name: create /var/lib/pgsql/data
  file: state=directory dest=/var/lib/pgsql/data owner=postgres group=postgres

- name: create /etc/patroni
  file: state=directory dest=/etc/patroni

- name: put postgres.yml
  template: src=postgres0.yml dest=/etc/patroni/postgres.yml backup=yes

- name: checkout patroni
  git: repo=https://github.com/zalando/patroni.git dest=/opt/patroni

- name: install pip
  yum: name=python2-pip
  when: "ansible_os_family == 'RedHat'"

- name: install python-etcd
  pip: name=python-etcd

- name: install dnspython
  pip: name=dnspython

- name: install boto
  pip: name=boto

- name: install mock
  pip: name=mock

- name: install psycopg2
  pip: name=psycopg2

- name: install PyYAML
  pip: name=PyYAML

- name: install requests
  pip: name=requests

- name: install six
  pip: name=six

- name: install kazoo
  pip: name=kazoo

- name: install gcc
  yum: name=gcc
  when: "ansible_os_family == 'RedHat'"

- name: install python-devel
  yum: name=python-devel
  when: "ansible_os_family == 'RedHat'"

- name: install psutil
  pip: name=psutil

- name: install python-dateutil
  pip: name=python-dateutil

- name: install python-consul
  pip: name=python-consul

- name: put patroni.sh
  template: src=patroni.sh dest=/var/lib/postgresql/patroni.sh mode=0755 backup=yes
  when: "ansible_distribution == 'Ubuntu' and (ansible_distribution_version|version_compare(14.04, '<='))"

- name: put patroni.rb
  template: src=patroni.rb dest=/etc/eye/patroni.rb backup=yes
  when: "ansible_distribution == 'Ubuntu' and (ansible_distribution_version|version_compare(14.04, '<='))"

- name: reload eye
  command: bash -c "source /usr/local/rvm/scripts/rvm && eye l /etc/eye/apps.eye"
  when: "ansible_distribution == 'Ubuntu' and (ansible_distribution_version|version_compare(14.04, '<='))"

- name: disable the default service
  service: name={{ patroni_pg_default_service }} state=stopped enabled=no

- name: put a systemctl unit file
  template: src=patroni.service dest=/etc/systemd/system/patroni.service
  when: "(ansible_distribution == 'Debian' and ansible_distribution_major_version == '8') or (ansible_distribution == 'Ubuntu' and (ansible_distribution_version|version_compare(14.04, '>'))) or (ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7')"

- name: enable and start patroni service
  service: name="patroni" enabled=yes state=started
  when: "(ansible_distribution == 'Debian' and ansible_distribution_major_version == '8') or (ansible_distribution == 'Ubuntu' and (ansible_distribution_version|version_compare(14.04, '>'))) or (ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7')"<commit_msg>Debian 9 tweaks<commit_after>---
- name: install EPEL repo
  yum: name=https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm state=present
  when: "ansible_os_family == 'RedHat'"

- name: install git
  package: name=git

- name: create /var/lib/pgsql/data
  file: state=directory dest=/var/lib/pgsql/data owner=postgres group=postgres

- name: create /etc/patroni
  file: state=directory dest=/etc/patroni

- name: put postgres.yml
  template: src=postgres0.yml dest=/etc/patroni/postgres.yml backup=yes

- name: checkout patroni
  git: repo=https://github.com/zalando/patroni.git dest=/opt/patroni version={{ patroni_version }}

- name: install pip
  yum: name=python2-pip
  when: "ansible_os_family == 'RedHat'"

- name: install pip
  yum: name=python-pip
  when: "ansible_os_family == 'Debian'"

- name: install python-etcd
  pip: name=python-etcd

- name: install dnspython
  pip: name=dnspython

- name: install boto
  pip: name=boto

- name: install mock
  pip: name=mock

- name: install psycopg2
  pip: name=psycopg2

- name: install PyYAML
  pip: name=PyYAML

- name: install requests
  pip: name=requests

- name: install six
  pip: name=six

- name: install kazoo
  pip: name=kazoo

- name: install gcc
  yum: name=gcc
  when: "ansible_os_family == 'RedHat'"

- name: install python-devel
  yum: name=python-devel
  when: "ansible_os_family == 'RedHat'"

- name: install psutil
  pip: name=psutil

- name: install python-dateutil
  pip: name=python-dateutil

- name: install python-consul
  pip: name=python-consul

- name: put patroni.sh
  template: src=patroni.sh dest=/var/lib/postgresql/patroni.sh mode=0755 backup=yes
  when: "ansible_distribution == 'Ubuntu' and (ansible_distribution_version|version_compare(14.04, '<='))"

- name: put patroni.rb
  template: src=patroni.rb dest=/etc/eye/patroni.rb backup=yes
  when: "ansible_distribution == 'Ubuntu' and (ansible_distribution_version|version_compare(14.04, '<='))"

- name: reload eye
  command: bash -c "source /usr/local/rvm/scripts/rvm && eye l /etc/eye/apps.eye"
  when: "ansible_distribution == 'Ubuntu' and (ansible_distribution_version|version_compare(14.04, '<='))"

- name: disable the default service
  service: name={{ patroni_pg_default_service }} state=stopped enabled=no

- name: put a systemctl unit file
  template: src=patroni.service dest=/etc/systemd/system/patroni.service
  when: "(ansible_distribution == 'Debian' and (ansible_distribution_major_version|version_compare(8, '>='))) or (ansible_distribution == 'Ubuntu' and (ansible_distribution_version|version_compare(14.04, '>'))) or (ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7')"

- name: enable and start patroni service
  service: name="patroni" enabled=yes state=started
  when: "(ansible_distribution == 'Debian' and (ansible_distribution_major_version|version_compare(8, '>='))) or (ansible_distribution == 'Ubuntu' and (ansible_distribution_version|version_compare(14.04, '>'))) or (ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7')"
{'fraction_non_alphanumeric': 0.1320913058073179, 'fraction_numerical': 0.011245384357166835, 'mean_word_length': 4.953046953046953, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 4, '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': '6150112', 'n_tokens_mistral': 2260, 'n_tokens_neox': 2118, 'n_words': 471}