<commit_before>---
# Load version specific values
- name: load JDK version vars
  with_first_found:
    - "../vars/jdk-versions/{{ java_version }}.yml"
    - ../vars/jdk-versions/default.yml
  include_vars: "{{ item }}"

- name: load JCE version vars
  with_first_found:
    - "../vars/jce-versions/{{ java_jce_version }}.yml"
    - ../vars/jce-versions/default.yml
  include_vars: "{{ item }}"

- name: assert version vars
  assert:
    that:
      - java_redis_sha256sum not in (None, '')
      - java_version_build not in (None, '')
      - java_jce_redis_sha256sum not in (None, '')
      - java_jce_redis_mirror not in (None, '')
      - java_jce_redis_filename not in (None, '')
      - java_jce_redis_folder not in (None, '')

- name: assert Binary Code License accepted
  assert:
    that:
      - java_license_declaration == 'I accept the "Oracle Binary Code License Agreement for the Java SE Platform Products and JavaFX" under the terms at http://www.oracle.com/technetwork/java/javase/terms/license/index.html'

# Create download directory
- name: create download directory
  file:
    state: directory
    mode: 'u=rwx,go=rx'
    dest: "{{ java_download_dir }}"

# Ensure CA certificates installed (so we can download the JDK)
- name: ensure ca-certificates installed
  become: yes
  apt:
    name: ca-certificates
    state: present
  when: ansible_os_family == "Debian"

# Download install files
- name: download JDK
  get_url:
    url: "{{ java_redis_mirror }}/{{ java_redis_filename }}"
    headers: 'Cookie:oraclelicense=accept-securebackup-cookie'
    dest: "{{ java_download_dir }}/{{ java_redis_filename }}"
    sha256sum: "{{ java_redis_sha256sum }}"
    force: false
    use_proxy: true
    validate_certs: true
    mode: 'u=rw,go=r'

- name: download JCE
  get_url:
    url: "{{ java_jce_redis_mirror }}/{{ java_jce_redis_filename }}"
    headers: 'Cookie:oraclelicense=accept-securebackup-cookie'
    dest: "{{ java_download_dir }}/{{ java_jce_redis_filename }}"
    sha256sum: "{{ java_jce_redis_sha256sum }}"
    force: false
    use_proxy: true
    validate_certs: true
    mode: 'u=rw,go=r'

# Unpack installation
- name: create Java home directory
  become: yes
  file:
    path: "{{ java_home }}"
    state: directory
    owner: root
    group: root
    mode: 'u=rwx,go=rx'

- name: install JDK
  become: yes
  unarchive:
    src: "{{ java_download_dir }}/{{ java_redis_filename }}"
    dest: "{{ java_install_dir }}"
    creates: "{{ java_home }}/bin/java"
    copy: no
    owner: root
    group: root
    mode: 'go-w'

- name: install unzip
  become: yes
  apt:
    name: unzip
    state: present

- name: unzip JCE
  unarchive:
    src: "{{ java_download_dir }}/{{ java_jce_redis_filename }}"
    dest: "{{ java_download_dir }}"
    creates: "{{ java_download_dir }}/{{ java_jce_redis_folder }}/local_policy.jar"
    copy: no
    mode: 'go-w'

- name: install local_policy.jar
  become: yes
  copy:
    src: "{{ java_download_dir }}/{{ java_jce_redis_folder }}/local_policy.jar"
    remote_src: yes
    dest: "{{ java_home }}/jre/lib/security/local_policy.jar"
    owner: root
    group: root

- name: install US_export_policy.jar
  become: yes
  copy:
    src: "{{ java_download_dir }}/{{ java_jce_redis_folder }}/US_export_policy.jar"
    remote_src: yes
    dest: "{{ java_home }}/jre/lib/security/US_export_policy.jar"
    owner: root
    group: root

# Set JAVA_HOME
- name: make sure /etc/profile.d exists
  become: yes
  file:
    path: /etc/profile.d
    state: directory
    owner: root
    group: root
    mode: 'u=rwx,go=rx'

- name: export JAVA_HOME and add to PATH
  become: yes
  template:
    src:  java.sh.j2
    dest: /etc/profile.d/java.sh
    owner: root
    group: root
    mode: 'a+x'

# Set Java facts
- name: create Ansible facts.d directory
  become: yes
  file:
    state: directory
    dest: /etc/ansible/facts.d
    owner: root
    group: root
    mode: 'u=rwx,go=rx'

- name: install Java facts
  become: yes
  template:
    src: facts.j2
    dest: /etc/ansible/facts.d/java.fact
    owner: root
    group: root
    mode: 'u=rw,go=r'

- name: re-read facts
  setup:
    filter: ansible_local
<commit_msg>Adopted yes|no convention for booleans (#23)<commit_after>---
# Load version specific values
- name: load JDK version vars
  with_first_found:
    - "../vars/jdk-versions/{{ java_version }}.yml"
    - ../vars/jdk-versions/default.yml
  include_vars: "{{ item }}"

- name: load JCE version vars
  with_first_found:
    - "../vars/jce-versions/{{ java_jce_version }}.yml"
    - ../vars/jce-versions/default.yml
  include_vars: "{{ item }}"

- name: assert version vars
  assert:
    that:
      - java_redis_sha256sum not in (None, '')
      - java_version_build not in (None, '')
      - java_jce_redis_sha256sum not in (None, '')
      - java_jce_redis_mirror not in (None, '')
      - java_jce_redis_filename not in (None, '')
      - java_jce_redis_folder not in (None, '')

- name: assert Binary Code License accepted
  assert:
    that:
      - java_license_declaration == 'I accept the "Oracle Binary Code License Agreement for the Java SE Platform Products and JavaFX" under the terms at http://www.oracle.com/technetwork/java/javase/terms/license/index.html'

# Create download directory
- name: create download directory
  file:
    state: directory
    mode: 'u=rwx,go=rx'
    dest: "{{ java_download_dir }}"

# Ensure CA certificates installed (so we can download the JDK)
- name: ensure ca-certificates installed
  become: yes
  apt:
    name: ca-certificates
    state: present
  when: ansible_os_family == "Debian"

# Download install files
- name: download JDK
  get_url:
    url: "{{ java_redis_mirror }}/{{ java_redis_filename }}"
    headers: 'Cookie:oraclelicense=accept-securebackup-cookie'
    dest: "{{ java_download_dir }}/{{ java_redis_filename }}"
    sha256sum: "{{ java_redis_sha256sum }}"
    force: no
    use_proxy: yes
    validate_certs: yes
    mode: 'u=rw,go=r'

- name: download JCE
  get_url:
    url: "{{ java_jce_redis_mirror }}/{{ java_jce_redis_filename }}"
    headers: 'Cookie:oraclelicense=accept-securebackup-cookie'
    dest: "{{ java_download_dir }}/{{ java_jce_redis_filename }}"
    sha256sum: "{{ java_jce_redis_sha256sum }}"
    force: no
    use_proxy: yes
    validate_certs: yes
    mode: 'u=rw,go=r'

# Unpack installation
- name: create Java home directory
  become: yes
  file:
    path: "{{ java_home }}"
    state: directory
    owner: root
    group: root
    mode: 'u=rwx,go=rx'

- name: install JDK
  become: yes
  unarchive:
    src: "{{ java_download_dir }}/{{ java_redis_filename }}"
    dest: "{{ java_install_dir }}"
    creates: "{{ java_home }}/bin/java"
    copy: no
    owner: root
    group: root
    mode: 'go-w'

- name: install unzip
  become: yes
  apt:
    name: unzip
    state: present

- name: unzip JCE
  unarchive:
    src: "{{ java_download_dir }}/{{ java_jce_redis_filename }}"
    dest: "{{ java_download_dir }}"
    creates: "{{ java_download_dir }}/{{ java_jce_redis_folder }}/local_policy.jar"
    copy: no
    mode: 'go-w'

- name: install local_policy.jar
  become: yes
  copy:
    src: "{{ java_download_dir }}/{{ java_jce_redis_folder }}/local_policy.jar"
    remote_src: yes
    dest: "{{ java_home }}/jre/lib/security/local_policy.jar"
    owner: root
    group: root

- name: install US_export_policy.jar
  become: yes
  copy:
    src: "{{ java_download_dir }}/{{ java_jce_redis_folder }}/US_export_policy.jar"
    remote_src: yes
    dest: "{{ java_home }}/jre/lib/security/US_export_policy.jar"
    owner: root
    group: root

# Set JAVA_HOME
- name: make sure /etc/profile.d exists
  become: yes
  file:
    path: /etc/profile.d
    state: directory
    owner: root
    group: root
    mode: 'u=rwx,go=rx'

- name: export JAVA_HOME and add to PATH
  become: yes
  template:
    src:  java.sh.j2
    dest: /etc/profile.d/java.sh
    owner: root
    group: root
    mode: 'a+x'

# Set Java facts
- name: create Ansible facts.d directory
  become: yes
  file:
    state: directory
    dest: /etc/ansible/facts.d
    owner: root
    group: root
    mode: 'u=rwx,go=rx'

- name: install Java facts
  become: yes
  template:
    src: facts.j2
    dest: /etc/ansible/facts.d/java.fact
    owner: root
    group: root
    mode: 'u=rw,go=r'

- name: re-read facts
  setup:
    filter: ansible_local

{'fraction_non_alphanumeric': 0.12737938465222076, 'fraction_numerical': 0.005028133604692925, 'mean_word_length': 3.0791015625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 30, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '177383', 'n_tokens_mistral': 3060, 'n_tokens_neox': 3010, 'n_words': 735}